Class: Enterprisifier::CodeGeneration::UnionGenerator

Inherits:
CodeGenerator
  • Object
show all
Defined in:
lib/enterprisifier/code_generation/generators/union_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, #to_ruby, #to_s, #write_file

Constructor Details

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

Instance Method Details

#attribute_macrosObject



9
10
11
12
13
# File 'lib/enterprisifier/code_generation/generators/union_generator.rb', line 9

def attribute_macros
  @attribute_macros ||= super.tap do |m|
    m << [:member_types, modularized_member_types.join(", ")] unless modularized_member_types.empty?
  end
end

#requiresObject



15
16
17
18
19
20
21
22
# File 'lib/enterprisifier/code_generation/generators/union_generator.rb', line 15

def requires
  @requires ||= super.tap do |r|
    mmt = modularized_member_types.collect do |mt|
      mt.split("::").map(&:underscore).join("/")
    end
    r.concat(mmt)
  end
end