Class: Flipflop::FeatureDefinition
- Inherits:
-
Object
- Object
- Flipflop::FeatureDefinition
- Defined in:
- lib/flipflop/feature_definition.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(key, **options) ⇒ FeatureDefinition
constructor
A new instance of FeatureDefinition.
Constructor Details
#initialize(key, **options) ⇒ FeatureDefinition
Returns a new instance of FeatureDefinition.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/flipflop/feature_definition.rb', line 5 def initialize(key, **) @key = key @name = @key.to_s.freeze @title = .delete(:title).freeze || @name.humanize.freeze @description = .delete(:description).freeze @default = !!.delete(:default) || false @group = .delete(:group).freeze @location = caller_locations(3, 1).first.freeze if .any? raise FeatureError.new(name, "has unknown option #{.keys.map(&:inspect) * ', '}") end end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
3 4 5 |
# File 'lib/flipflop/feature_definition.rb', line 3 def default @default end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/flipflop/feature_definition.rb', line 3 def description @description end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
3 4 5 |
# File 'lib/flipflop/feature_definition.rb', line 3 def group @group end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
3 4 5 |
# File 'lib/flipflop/feature_definition.rb', line 3 def key @key end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
3 4 5 |
# File 'lib/flipflop/feature_definition.rb', line 3 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/flipflop/feature_definition.rb', line 3 def name @name end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/flipflop/feature_definition.rb', line 3 def title @title end |