Module: RubyXmlMapper

Defined in:
lib/ruby-xml-mapper.rb

Defined Under Namespace

Modules: RubyXmlMapperClassMethods Classes: Boolean, Hash

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(model) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ruby-xml-mapper.rb', line 30

def self.included model
  model.extend RubyXmlMapper::RubyXmlMapperClassMethods
  
  model.class_inheritable_accessor :xml_name
  model.class_inheritable_accessor :source_dir_path
  
  model.class_inheritable_accessor :xml_self_mapping
  model.class_inheritable_accessor :xml_content_mapping
  model.class_inheritable_hash :xml_attr_mappings
  model.class_inheritable_hash :xml_child_mappings
  
  model.xml_attr_mappings = {}
  model.xml_child_mappings = {}
end

Instance Method Details

#initialize_from_xml(node) ⇒ Object



45
46
47
48
49
50
# File 'lib/ruby-xml-mapper.rb', line 45

def initialize_from_xml node
  initialize_from_xml_attr_mapping(node) if xml_attr_mappings.length
  initialize_from_xml_child_mapping(node) if xml_child_mappings.length
  initialize_from_xml_self_mapping(node) if xml_self_mapping
  initialize_from_xml_content_mapping(node) if xml_content_mapping
end