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.
-
#name_translation_key ⇒ String
readonly
Translation key to represent the feature in the UI.
Instance Method Summary collapse
-
#enable(config) ⇒ Object
Perform any configuration change that is needed to activate this feature.
-
#initialize(name, name_translation_key: nil) {|config| ... } ⇒ Feature
constructor
Create a block based feature.
Constructor Details
#initialize(name, name_translation_key: nil) {|config| ... } ⇒ Feature
Create a block based feature.
25 26 27 28 29 |
# File 'lib/pageflow/feature.rb', line 25 def initialize(name, name_translation_key: nil, &block) @name = name @name_translation_key = name_translation_key || "pageflow.#{name}.feature_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 |
#name_translation_key ⇒ String (readonly)
Translation key to represent the feature in the UI.
15 16 17 |
# File 'lib/pageflow/feature.rb', line 15 def name_translation_key @name_translation_key end |
Instance Method Details
#enable(config) ⇒ Object
Perform any configuration change that is needed to activate this feature.
35 36 37 |
# File 'lib/pageflow/feature.rb', line 35 def enable(config) @block.call(config) if @block end |