Class: Flipper::GateValues
- Inherits:
-
Object
- Object
- Flipper::GateValues
- Defined in:
- lib/flipper/gate_values.rb
Constant Summary collapse
- LegitIvars =
Private: Array of instance variables that are readable through the [] instance method.
{ "boolean" => "@boolean", "actors" => "@actors", "groups" => "@groups", "percentage_of_time" => "@percentage_of_time", "percentage_of_actors" => "@percentage_of_actors", }.freeze
Instance Attribute Summary collapse
-
#actors ⇒ Object
readonly
Returns the value of attribute actors.
-
#boolean ⇒ Object
readonly
Returns the value of attribute boolean.
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
-
#percentage_of_actors ⇒ Object
readonly
Returns the value of attribute percentage_of_actors.
-
#percentage_of_time ⇒ Object
readonly
Returns the value of attribute percentage_of_time.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(adapter_values) ⇒ GateValues
constructor
A new instance of GateValues.
Constructor Details
#initialize(adapter_values) ⇒ GateValues
Returns a new instance of GateValues.
21 22 23 24 25 26 27 |
# File 'lib/flipper/gate_values.rb', line 21 def initialize(adapter_values) @boolean = Typecast.to_boolean(adapter_values[:boolean]) @actors = Typecast.to_set(adapter_values[:actors]) @groups = Typecast.to_set(adapter_values[:groups]) @percentage_of_actors = Typecast.to_integer(adapter_values[:percentage_of_actors]) @percentage_of_time = Typecast.to_integer(adapter_values[:percentage_of_time]) end |
Instance Attribute Details
#actors ⇒ Object (readonly)
Returns the value of attribute actors.
16 17 18 |
# File 'lib/flipper/gate_values.rb', line 16 def actors @actors end |
#boolean ⇒ Object (readonly)
Returns the value of attribute boolean.
15 16 17 |
# File 'lib/flipper/gate_values.rb', line 15 def boolean @boolean end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
17 18 19 |
# File 'lib/flipper/gate_values.rb', line 17 def groups @groups end |
#percentage_of_actors ⇒ Object (readonly)
Returns the value of attribute percentage_of_actors.
18 19 20 |
# File 'lib/flipper/gate_values.rb', line 18 def percentage_of_actors @percentage_of_actors end |
#percentage_of_time ⇒ Object (readonly)
Returns the value of attribute percentage_of_time.
19 20 21 |
# File 'lib/flipper/gate_values.rb', line 19 def percentage_of_time @percentage_of_time end |
Instance Method Details
#[](key) ⇒ Object
29 30 31 32 33 |
# File 'lib/flipper/gate_values.rb', line 29 def [](key) if ivar = LegitIvars[key.to_s] instance_variable_get(ivar) end end |
#eql?(other) ⇒ Boolean Also known as: ==
35 36 37 38 39 40 41 42 |
# File 'lib/flipper/gate_values.rb', line 35 def eql?(other) self.class.eql?(other.class) && boolean == other.boolean && actors == other.actors && groups == other.groups && percentage_of_actors == other.percentage_of_actors && percentage_of_time == other.percentage_of_time end |