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

Inherits:
Object
  • Object
show all
Extended by:
Forwardable, 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 SharedContext

attach_context

Constructor Details

#initialize(feature_name, sub_feature_name, component) ⇒ Feature

Returns a new instance of Feature.



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

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.



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

def printables
  @printables
end

Instance Attribute Details

#componentObject (readonly)

Returns the value of attribute component.



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

def component
  @component
end

Instance Method Details

#feature_name(verbose: false) ⇒ Object



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

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

#inspectObject



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

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