Class: RgGen::Core::Base::Feature

Inherits:
Object
  • Object
show all
Extended by:
Forwardable, FeatureVariable, InternalStruct, SharedContext
Defined in:
lib/rggen/core/base/feature.rb

Direct Known Subclasses

InputBase::Feature, OutputBase::Feature

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from 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 SharedContext

attach_context

Constructor Details

#initialize(feature_name, sub_feature_name, component) ⇒ Feature

Returns a new instance of Feature.



12
13
14
15
16
17
18
# File 'lib/rggen/core/base/feature.rb', line 12

def initialize(feature_name, sub_feature_name, component)
  @feature_name = feature_name
  @sub_feature_name = sub_feature_name
  @component = component
  post_initialize
  block_given? && yield(self)
end

Class Attribute Details

.printablesObject (readonly)

Returns the value of attribute printables.



36
37
38
# File 'lib/rggen/core/base/feature.rb', line 36

def printables
  @printables
end

Instance Attribute Details

#componentObject (readonly)

Returns the value of attribute component.



20
21
22
# File 'lib/rggen/core/base/feature.rb', line 20

def component
  @component
end

Instance Method Details

#feature_name(verbose: false) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/rggen/core/base/feature.rb', line 22

def feature_name(verbose: false)
  if verbose
    [@feature_name, @sub_feature_name]
      .compact.reject(&:empty?).join(':')
  else
    @feature_name
  end
end

#inspectObject



31
32
33
# File 'lib/rggen/core/base/feature.rb', line 31

def inspect
  "#{feature_name(verbose: true)}(#{component})"
end