Class: Xmi::EaRoot

Inherits:
Object
  • Object
show all
Defined in:
lib/xmi/ea_root.rb,
lib/xmi/extensions/gml.rb,
lib/xmi/extensions/eauml.rb

Overview

rubocop:disable Metrics/ClassLength

Defined Under Namespace

Modules: Eauml, Gml

Constant Summary collapse

MODULE_TEMPLATE =
<<~TEXT
  module Xmi
    class EaRoot
      module #MODULE_NAME#
  #KLASSES#
      end
    end
  end
TEXT
KLASS_TEMPLATE =
<<~TEXT
        class #KLASS_NAME# < #FROM_KLASS#
          #ROOT_TAG_LINE#

  #ATTRIBUTES##XML_MAPPING#
        end
TEXT
XML_MAPPING =
<<~TEXT
          xml do
            root "#ROOT_TAG#"
  #MAP_ATTRIBUTES#
          end
TEXT
ATTRIBUTE_LINE =
<<~TEXT
  attribute :#TAG_NAME#, #ATTRIBUTE_TYPE#
TEXT
MAP_ATTRIBUTES =
<<~TEXT
  map_attribute "#ATTRIBUTE_NAME#", to: :#ATTRIBUTE_METHOD#
TEXT
MAP_ELEMENT =
<<~TEXT
  map_element "#ELEMENT_NAME#",
              to: :#ELEMENT_METHOD#,
              namespace: "#NAMESPACE#",
              prefix: "#PREFIX#"
TEXT

Class Method Summary collapse

Class Method Details

.load_extension(xml_path) ⇒ Object



50
51
52
53
54
# File 'lib/xmi/ea_root.rb', line 50

def load_extension(xml_path)
  @content = gen_content(xml_path)
  Object.class_eval @content
  update_mappings(@module_name)
end

.output_rb_file(output_rb_path) ⇒ Object



56
57
58
# File 'lib/xmi/ea_root.rb', line 56

def output_rb_file(output_rb_path)
  File.open(output_rb_path, "w") { |file| file.write(@content) }
end