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.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
- #control? ⇒ Boolean
-
#initialize(flag_name, adapter:, context: nil, data: {}, record: nil) ⇒ Flag
constructor
A new instance of Flag.
- #off? ⇒ Boolean
- #on? ⇒ Boolean
- #treatment_config ⇒ Object
- #treatment_value ⇒ Object
Constructor Details
#initialize(flag_name, adapter:, context: nil, data: {}, record: nil) ⇒ Flag
Returns a new instance of Flag.
5 6 7 8 9 10 11 |
# File 'lib/this_feature/flag.rb', line 5 def initialize(flag_name, adapter:, context: nil, data: {}, record: nil) @flag_name = flag_name @adapter = adapter @context = context @data = data @record = record 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 |
#record ⇒ Object (readonly)
Returns the value of attribute record.
3 4 5 |
# File 'lib/this_feature/flag.rb', line 3 def record @record end |
Instance Method Details
#control? ⇒ Boolean
21 22 23 |
# File 'lib/this_feature/flag.rb', line 21 def control? adapter.control?(flag_name, context: context, data: data, record: record) end |
#off? ⇒ Boolean
17 18 19 |
# File 'lib/this_feature/flag.rb', line 17 def off? adapter.off?(flag_name, context: context, data: data, record: record) end |
#on? ⇒ Boolean
13 14 15 |
# File 'lib/this_feature/flag.rb', line 13 def on? adapter.on?(flag_name, context: context, data: data, record: record) end |
#treatment_config ⇒ Object
29 30 31 |
# File 'lib/this_feature/flag.rb', line 29 def treatment_config adapter.treatment_config(flag_name, context: context, data: data, record: record) end |
#treatment_value ⇒ Object
25 26 27 |
# File 'lib/this_feature/flag.rb', line 25 def treatment_value adapter.treatment_value(flag_name, context: context, data: data, record: record) end |