Class: Nova::Common::Features::Feature
- Inherits:
-
Object
- Object
- Nova::Common::Features::Feature
- Includes:
- EventHandler
- Defined in:
- lib/nova/common/features/feature.rb
Overview
The information about the feature that was defined.
Instance Attribute Summary collapse
-
#name ⇒ Symbol
The name of the feature.
-
#options ⇒ Hash
The options of the feature.
Instance Method Summary collapse
-
#disable! ⇒ nil, Object
Disables the feature and runs the :disable event, if it exists.
-
#enable! ⇒ nil, Object
Enables the feature and runs the :enable event, if it exists.
-
#fake! ⇒ self
Marks this feature as fake.
-
#fake? ⇒ Boolean
Whether or not this feature is fake.
-
#initialize(name, options) ⇒ Feature
constructor
A new instance of Feature.
Methods included from EventHandler
Constructor Details
#initialize(name, options) ⇒ Feature
Returns a new instance of Feature.
18 19 20 21 22 23 |
# File 'lib/nova/common/features/feature.rb', line 18 def initialize(name, ) @name = name = @bind = Object.new @fake = false end |
Instance Attribute Details
#name ⇒ Symbol
The name of the feature.
11 12 13 |
# File 'lib/nova/common/features/feature.rb', line 11 def name @name end |
#options ⇒ Hash
The options of the feature.
16 17 18 |
# File 'lib/nova/common/features/feature.rb', line 16 def end |
Instance Method Details
#disable! ⇒ nil, Object
Disables the feature and runs the :disable event, if it exists.
39 40 41 |
# File 'lib/nova/common/features/feature.rb', line 39 def disable! run(:disable) end |
#enable! ⇒ nil, Object
Enables the feature and runs the :enable event, if it exists.
31 32 33 |
# File 'lib/nova/common/features/feature.rb', line 31 def enable! run(:enable) end |
#fake! ⇒ self
Marks this feature as fake. This is not reversable.
57 58 59 60 |
# File 'lib/nova/common/features/feature.rb', line 57 def fake! @fake = true self end |
#fake? ⇒ Boolean
Whether or not this feature is fake. By fake, it means that it was not created with the defining class as a feature; it does not have any events at all, and its only purpose is to mock the behavior of a real, defined feature.
49 50 51 |
# File 'lib/nova/common/features/feature.rb', line 49 def fake? @fake end |