Class: RgGen::Core::Base::FeatureFactory
- Extended by:
- SharedContext
- Defined in:
- lib/rggen/core/base/feature_factory.rb
Direct Known Subclasses
Instance Method Summary collapse
- #create_feature(component, *args) ⇒ Object
-
#initialize(feature_name) ⇒ FeatureFactory
constructor
A new instance of FeatureFactory.
Methods included from SharedContext
Constructor Details
#initialize(feature_name) ⇒ FeatureFactory
Returns a new instance of FeatureFactory.
9 10 11 12 |
# File 'lib/rggen/core/base/feature_factory.rb', line 9 def initialize(feature_name) @feature_name = feature_name block_given? && yield(self) end |
Instance Method Details
#create_feature(component, *args) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/rggen/core/base/feature_factory.rb', line 17 def create_feature(component, *args) klass, sub_feature_name = select_feature(*args) klass.new(@feature_name, sub_feature_name, component) do |feature| feature.available? || break block_given? && yield(feature) component.add_feature(feature) end end |