class Flagship::Feature
Attributes
key[R]
Public Class Methods
new(key, enabled, context, tags = {})
click to toggle source
# File lib/flagship/feature.rb, line 4 def initialize(key, enabled, context, tags = {}) @key = key @enabled = enabled @context = context @tags = tags end
Public Instance Methods
disabled?()
click to toggle source
# File lib/flagship/feature.rb, line 30 def disabled? !enabled? end
enabled?()
click to toggle source
# File lib/flagship/feature.rb, line 11 def enabled? env = ENV['FLAGSHIP_' + key.to_s.upcase] if env case env.downcase when '1', 'true' return true when '0', 'false', '' return false end end if @enabled.respond_to?(:call) !!@enabled.call(@context) else !!@enabled end end
extend_feature(feature)
click to toggle source
# File lib/flagship/feature.rb, line 34 def extend_feature(feature) self.class.new(@key, @enabled, @context, feature.tags.merge(@tags)) end