module

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
Source
disable(name : String)

Disables the feature and returns false.

CanUse.disable("feature_two") # => false
Source
enable(name : String)

Enables the feature and returns true.

CanUse.enable("feature_three") # => true
Source
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
Source
feature?(name : String, &)

Evaluates the block if the feature returns true..

CanUse.feature?("feature_one") do
  puts "Yeah, I cam use!"
end
Source

Nested types