Class: RgGen::Core::InputBase::FeatureFactory

Inherits:
Base::FeatureFactory show all
Includes:
Utility::TypeChecker
Defined in:
lib/rggen/core/input_base/feature_factory.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base::FeatureFactory

#create_feature, #initialize

Methods included from Base::SharedContext

#attach_context

Constructor Details

This class inherits a constructor from RgGen::Core::Base::FeatureFactory

Class Attribute Details

.value_converterObject (readonly)

Returns the value of attribute value_converter.



14
15
16
# File 'lib/rggen/core/input_base/feature_factory.rb', line 14

def value_converter
  @value_converter
end

Class Method Details

.convert_value(&block) ⇒ Object



10
11
12
# File 'lib/rggen/core/input_base/feature_factory.rb', line 10

def convert_value(&block)
  @value_converter = block
end

.default_value(&block) ⇒ Object



16
17
18
19
# File 'lib/rggen/core/input_base/feature_factory.rb', line 16

def default_value(&block)
  @default_value = block if block_given?
  @default_value
end

.value_format(format = nil, **options) ⇒ Object



21
22
23
24
# File 'lib/rggen/core/input_base/feature_factory.rb', line 21

def value_format(format = nil, **options)
  @value_format = [format, options] if format
  @value_format
end

Instance Method Details

#active_feature_factory?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/rggen/core/input_base/feature_factory.rb', line 35

def active_feature_factory?
  !passive_feature_factory?
end

#create(component, *args) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/rggen/core/input_base/feature_factory.rb', line 27

def create(component, *args)
  input_value = process_input_value(args.last)
  create_feature(component, *args[0..-2], input_value) do |feature|
    build_feature(feature, input_value)
    feature.verify(:feature)
  end
end

#passive_feature_factory?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/rggen/core/input_base/feature_factory.rb', line 39

def passive_feature_factory?
  @target_features.nil? && @target_feature.passive_feature?
end