Class: Enterprisifier::CodeGeneration::ElementGenerator

Inherits:
CodeGenerator
  • Object
show all
Defined in:
lib/enterprisifier/code_generation/generators/element_generator.rb

Constant Summary

Constants inherited from CodeGenerator

CodeGenerator::FacetElements

Instance Attribute Summary

Attributes inherited from CodeGenerator

#dependencies, #entity_name

Instance Method Summary collapse

Methods inherited from CodeGenerator

build, #entity_or_attr_name, extends, #extension_require, #initialize, macro_mappings, #macro_reference_require, #name, register, #requires, #to_ruby, #to_s, #write_file

Constructor Details

This class inherits a constructor from Enterprisifier::CodeGeneration::CodeGenerator

Instance Method Details

#attribute_macrosObject



20
21
22
23
24
# File 'lib/enterprisifier/code_generation/generators/element_generator.rb', line 20

def attribute_macros
  @attribute_macros ||= super.tap do |m|
    m << [:substitution_group, @generator.modularize_type(@node.substitution_group, @mod_name, "Elements")] if @node.substitution_group
  end
end

#macro_reference_typeObject



10
11
12
13
14
15
16
17
18
# File 'lib/enterprisifier/code_generation/generators/element_generator.rb', line 10

def macro_reference_type
  if @node.ref
    @generator.modularize_type(@node.ref, @mod_name, "Elements")
  elsif @node.element_type
    @generator.modularize_type(@node.element_type, @mod_name, "Types")
  else
    nil
  end
end