Class: RgGen::Core::InputBase::Feature

Inherits:
Base::Feature show all
Includes:
ConversionUtility, RaiseError, Utility::RegexpPatterns, Utility::TypeChecker
Defined in:
lib/rggen/core/input_base/feature.rb

Direct Known Subclasses

Configuration::Feature, RegisterMap::Feature

Instance Attribute Summary collapse

Attributes inherited from Base::Feature

#component

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utility::RegexpPatterns

included

Methods inherited from Base::Feature

#feature_name, #initialize

Methods included from Base::FeatureVariable

extended, #feature_array_variable_get, #feature_hash_array_variable_get, #feature_hash_variable_fetch, #feature_hash_variable_get, #feaure_scala_variable_get

Methods included from Base::SharedContext

#attach_context

Constructor Details

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

Instance Attribute Details

#positionObject (readonly)

Returns the value of attribute position.



109
110
111
# File 'lib/rggen/core/input_base/feature.rb', line 109

def position
  @position
end

Class Method Details

.active_feature?Boolean

Returns:

  • (Boolean)


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

def active_feature?
  !passive_feature?
end

.passive_feature?Boolean

Returns:

  • (Boolean)


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

def passive_feature?
  feature_array_variable_get(:@builders).nil?
end

.propertiesObject



13
14
15
# File 'lib/rggen/core/input_base/feature.rb', line 13

def properties
  feature_hash_variable_get(:@properties)&.keys
end

Instance Method Details

#build(*args) ⇒ Object



74
75
76
77
78
79
# File 'lib/rggen/core/input_base/feature.rb', line 74

def build(*args)
  builders = feature_array_variable_get(:@builders)
  return unless builders

  do_build(builders, args)
end

#error_positionObject



111
112
113
114
115
116
117
118
119
# File 'lib/rggen/core/input_base/feature.rb', line 111

def error_position
  if position
    position
  else
    approximate_position =
      component.features.map(&:position).find(&:itself)
    ApproximatelyErrorPosition.create(approximate_position)
  end
end

#ignore_empty_value?Boolean

Returns:

  • (Boolean)


86
87
88
89
# File 'lib/rggen/core/input_base/feature.rb', line 86

def ignore_empty_value?
  feaure_scala_variable_get(:@ignore_empty_value)
    .then { _1.nil? || _1 }
end

#inspectObject



104
105
106
107
# File 'lib/rggen/core/input_base/feature.rb', line 104

def inspect
  printable_values = printables&.map { |name, value| "#{name}: #{value.inspect}" }
  (printable_values && "#{super}[#{printable_values.join(', ')}]") || super
end

#post_buildObject



81
82
83
84
# File 'lib/rggen/core/input_base/feature.rb', line 81

def post_build
  feature_array_variable_get(:@post_builders)
    &.each { |block| instance_exec(&block) }
end

#printable?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/rggen/core/input_base/feature.rb', line 100

def printable?
  !feature_hash_variable_get(:@printables).nil?
end

#printablesObject



95
96
97
98
# File 'lib/rggen/core/input_base/feature.rb', line 95

def printables
  feature_hash_variable_get(:@printables)
    &.map { |name, body| [name, printable(name, &body)] }
end

#propertiesObject



70
71
72
# File 'lib/rggen/core/input_base/feature.rb', line 70

def properties
  feature_hash_variable_get(:@properties)&.keys
end

#verify(scope) ⇒ Object



91
92
93
# File 'lib/rggen/core/input_base/feature.rb', line 91

def verify(scope)
  verified?(scope) || do_verify(scope)
end