Class: Pageflow::Feature
- Inherits:
-
Object
- Object
- Pageflow::Feature
- Defined in:
- lib/pageflow/feature.rb
Overview
Represents a set of configuration changes that can be performed based on account or entry feature flags.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
Unique identifyer of feature.
Instance Method Summary collapse
-
#enable(config) ⇒ Object
Perform any configuration change that is needed to activate this feature.
-
#initialize(name) {|config| ... } ⇒ Feature
constructor
Create a block based feature.
- #name_translation_key ⇒ Object
Constructor Details
#initialize(name) {|config| ... } ⇒ Feature
Create a block based feature.
16 17 18 19 |
# File 'lib/pageflow/feature.rb', line 16 def initialize(name, &block) @name = name @block = block end |
Instance Attribute Details
#name ⇒ String (readonly)
Unique identifyer of feature.
10 11 12 |
# File 'lib/pageflow/feature.rb', line 10 def name @name end |
Instance Method Details
#enable(config) ⇒ Object
Perform any configuration change that is needed to activate this feature.
25 26 27 |
# File 'lib/pageflow/feature.rb', line 25 def enable(config) @block.call(config) if @block end |
#name_translation_key ⇒ Object
29 30 31 |
# File 'lib/pageflow/feature.rb', line 29 def name_translation_key "pageflow.#{name}.feature_name" end |