Class: Xmi::EaRoot
- Inherits:
-
Object
- Object
- Xmi::EaRoot
- 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
Constant Summary collapse
- MODULE_TEMPLATE =
"module Xmi\n class EaRoot\n module #MODULE_NAME#\n#KLASSES#\n end\n end\nend\n"- KLASS_TEMPLATE =
" class #KLASS_NAME# < #FROM_KLASS#\n #ROOT_TAG_LINE#\n\n#ATTRIBUTES##XML_MAPPING#\n end\n"- XML_MAPPING =
" xml do\n root \"#ROOT_TAG#\"\n#MAP_ATTRIBUTES#\n end\n"- ATTRIBUTE_LINE =
"attribute :#TAG_NAME#, #ATTRIBUTE_TYPE#\n"- MAP_ATTRIBUTES =
"map_attribute \"#ATTRIBUTE_NAME#\", to: :#ATTRIBUTE_METHOD#\n"- MAP_ELEMENT =
"map_element \"#ELEMENT_NAME#\",\n to: :#ELEMENT_METHOD#,\n namespace: \"#NAMESPACE#\",\n prefix: \"#PREFIX#\",\n value_map: {\n from: { nil: :empty, empty: :empty, omitted: :empty },\n to: { nil: :empty, empty: :empty, omitted: :empty }\n }\n"
Class Method Summary collapse
Class Method Details
.load_extension(xml_path) ⇒ Object
54 55 56 57 58 |
# File 'lib/xmi/ea_root.rb', line 54 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
60 61 62 |
# File 'lib/xmi/ea_root.rb', line 60 def output_rb_file(output_rb_path) File.open(output_rb_path, "w") { |file| file.write(@content) } end |