CanUse
CanUse is a minimalist feature toggle for Crystal.
Constants
VERSION = "0.2.0"
Class methods
configure
Sets the configuration for CanUse
CanUse.configure do |config|
config.environment = "development"
config.file = "config/features.yml"
end
disable(name : String)
Disables the feature and returns false.
CanUse.disable("feature_two") # => false
enable(name : String)
Enables the feature and returns true.
CanUse.enable("feature_three") # => true
feature?(name : YAML::Any::Type)
Returns true or false based on the feature configuration.
Otherwise, reads from the default value.
if CanUse.feature?("feature_one")
# do_something
end
feature?(name : String, &)
Evaluates the block if the feature returns true..
CanUse.feature?("feature_one") do
puts "Yeah, I cam use!"
end