class Flipper::Gates::Boolean

Public Instance Methods

data_type() click to toggle source
# File lib/flipper/gates/boolean.rb, line 14
def data_type
  :boolean
end
enabled?(value) click to toggle source
# File lib/flipper/gates/boolean.rb, line 18
def enabled?(value)
  !!value
end
key() click to toggle source

Internal: Name converted to value safe for adapter.

# File lib/flipper/gates/boolean.rb, line 10
def key
  :boolean
end
name() click to toggle source

Internal: The name of the gate. Used for instrumentation, etc.

# File lib/flipper/gates/boolean.rb, line 5
def name
  :boolean
end
open?(context) click to toggle source

Internal: Checks if the gate is open for a thing.

Returns true if explicitly set to true, false if explicitly set to false or nil if not explicitly set.

# File lib/flipper/gates/boolean.rb, line 26
def open?(context)
  context.values[key]
end
protects?(thing) click to toggle source
# File lib/flipper/gates/boolean.rb, line 34
def protects?(thing)
  case thing
  when Types::Boolean, TrueClass, FalseClass
    true
  else
    false
  end
end
wrap(thing) click to toggle source
# File lib/flipper/gates/boolean.rb, line 30
def wrap(thing)
  Types::Boolean.wrap(thing)
end