Class: RgGen::Core::OutputBase::Feature

Inherits:
Base::Feature show all
Includes:
Base::FeatureLayerExtension, CodeGeneratable, RaiseError
Defined in:
lib/rggen/core/output_base/feature.rb

Constant Summary

Constants included from CodeGeneratable

CodeGeneratable::CODE_PHASES, CodeGeneratable::TEMPLATE_PROCESSOR, CodeGeneratable::VARIABLE_NAMES

Instance Attribute Summary

Attributes inherited from Base::Feature

#component

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RaiseError

#error

Methods included from CodeGeneratable

#generate_code, included

Methods inherited from Base::Feature

#feature_name, #initialize, #inspect

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

Class Method Details

.exported_methodsObject



12
13
14
# File 'lib/rggen/core/output_base/feature.rb', line 12

def exported_methods
  feature_array_variable_get(:@exported_methods)
end

Instance Method Details

#buildObject



47
48
49
50
# File 'lib/rggen/core/output_base/feature.rb', line 47

def build
  feature_array_variable_get(:@builders)
    &.each { |body| instance_exec(&body) }
end

#export(*methods) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/rggen/core/output_base/feature.rb', line 52

def export(*methods)
  methods.each do |method|
    unless exported_methods(:class)&.include?(method) ||
           exported_methods(:object)&.include?(method)
      (@exported_methods ||= []) << method
    end
  end
end

#exported_methods(scope) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/rggen/core/output_base/feature.rb', line 61

def exported_methods(scope)
  if scope == :class
    self.class.exported_methods
  else
    @exported_methods
  end
end

#post_initializeObject



38
39
40
# File 'lib/rggen/core/output_base/feature.rb', line 38

def post_initialize
  define_layer_methods
end

#pre_buildObject



42
43
44
45
# File 'lib/rggen/core/output_base/feature.rb', line 42

def pre_build
  feature_array_variable_get(:@pre_builders)
    &.each { |body| instance_exec(&body) }
end

#write_file(directory = nil) ⇒ Object



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

def write_file(directory = nil)
  feaure_scala_variable_get(:@file_writer)
    &.write_file(self, directory)
end