Class: Togls::Rules::Boolean

Inherits:
Togls::Rule show all
Defined in:
lib/togls/rules/boolean.rb

Overview

Boolean Rule

The Boolean Rule is a provided Rule that expects to be given a boolean as it’s initialization data and when evaluated determines the toggle state based on the initialization value. Example:

always_on = Togls::Rules::Boolean.new(true) Togls.features do

feature(:foo).on(always_on)

end

if Togls.feature(:foo).on?

...

end

Instance Attribute Summary

Attributes inherited from Togls::Rule

#data

Instance Method Summary collapse

Methods inherited from Togls::Rule

#id, #initialize

Constructor Details

This class inherits a constructor from Togls::Rule

Instance Method Details

#run(_key, _target = nil) ⇒ Object



18
19
20
# File 'lib/togls/rules/boolean.rb', line 18

def run(_key, _target = nil)
  @data
end