Class: ThisFeature::Flag
- Inherits:
-
Object
- Object
- ThisFeature::Flag
- Defined in:
- lib/this_feature/flag.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#flag_name ⇒ Object
readonly
Returns the value of attribute flag_name.
Instance Method Summary collapse
- #control? ⇒ Boolean
-
#initialize(flag_name, adapter:, context: nil, data: {}) ⇒ Flag
constructor
A new instance of Flag.
- #off? ⇒ Boolean
- #on? ⇒ Boolean
Constructor Details
#initialize(flag_name, adapter:, context: nil, data: {}) ⇒ Flag
Returns a new instance of Flag.
5 6 7 8 9 10 |
# File 'lib/this_feature/flag.rb', line 5 def initialize(flag_name, adapter:, context: nil, data: {}) @flag_name = flag_name @adapter = adapter @context = context @data = data end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
3 4 5 |
# File 'lib/this_feature/flag.rb', line 3 def adapter @adapter end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
3 4 5 |
# File 'lib/this_feature/flag.rb', line 3 def context @context end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/this_feature/flag.rb', line 3 def data @data end |
#flag_name ⇒ Object (readonly)
Returns the value of attribute flag_name.
3 4 5 |
# File 'lib/this_feature/flag.rb', line 3 def flag_name @flag_name end |
Instance Method Details
#control? ⇒ Boolean
20 21 22 |
# File 'lib/this_feature/flag.rb', line 20 def control? adapter.control?(flag_name, context: context, data: data) end |
#off? ⇒ Boolean
16 17 18 |
# File 'lib/this_feature/flag.rb', line 16 def off? adapter.off?(flag_name, context: context, data: data) end |
#on? ⇒ Boolean
12 13 14 |
# File 'lib/this_feature/flag.rb', line 12 def on? adapter.on?(flag_name, context: context, data: data) end |