Module: RubyXmlMapper

Included in:
RSS::Channel, RSS::Item, RSS::RSS
Defined in:
lib/ruby-xml-mapper.rb,
lib/ruby-xml-mapper.rb

Defined Under Namespace

Modules: RubyXmlMapperClassMethods Classes: Boolean, CircularReference, FileCache, FileCacheItem, Hash

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(model) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ruby-xml-mapper.rb', line 37

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



52
53
54
55
56
57
# File 'lib/ruby-xml-mapper.rb', line 52

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