-
Notifications
You must be signed in to change notification settings - Fork 0
Organize Toggle Definitions
Togls supports the ability to expand on existing Togl definitions by using multiple Togls.release
blocks. This is really a convenience feature to be able to better organize your feature toggles by splitting them into multiple blocks or potentially even files.
For example if you have a set of feature toggle definitions that looks as follows.
# config/initializers/togls_features.rb
Togls.release do
feature(:foo, "Some foo feature").on
feature(:foo1, "Some foo1 feature").on
feature(:foo2, "Some foo2 feature").on
end
You can expand this set by defining another Togls.release
block leaving your config/initalizer/togls_features.rb
looking as follows.
# config/initializers/togls_features.rb
Togls.release do
feature(:foo, "Some foo feature").on
feature(:foo1, "Some foo1 feature").on
feature(:foo2, "Some foo2 feature").on
end
Togls.release do
feature(:bar, "Some bar feature").on
feature(:bar1, "Some bar1 feature").on
feature(:bar2, "Some bar2 feature").on
end
Note: The above is technically equivalent to the following though potentially better organized if foo
, foo1
, and foo2
are related in some way and bar
, bar1
, and bar2
are related.
# config/initializers/togls_features.rb
Togls.release do
feature(:foo, "Some foo feature").on
feature(:foo1, "Some foo1 feature").on
feature(:foo2, "Some foo2 feature").on
feature(:bar, "Some bar feature").on
feature(:bar1, "Some bar1 feature").on
feature(:bar2, "Some bar2 feature").on
end
Prior to v3.0.0 you had to defined feature toggles using the Togls.features
block rather than the Togls.release
block. So, if you are using a version prior to v3.0.0 conceptually replace the Togls.release
in the above example with Togls.features
.