Class: SaxStream::Internal::Mappings::Element

Inherits:
Base
  • Object
show all
Defined in:
lib/sax_stream/internal/mappings/element.rb

Direct Known Subclasses

ElementAttribute, ElementContent

Instance Attribute Summary

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods inherited from Base

#find_or_insert_parent_node, #handler_for, #initialize, #path_parts, #update_parent_node

Constructor Details

This class inherits a constructor from SaxStream::Internal::Mappings::Base

Instance Method Details

#find_or_insert_node(doc, base) ⇒ Object



20
21
22
# File 'lib/sax_stream/internal/mappings/element.rb', line 20

def find_or_insert_node(doc, base)
  find_or_insert_nested_node(doc, base, path_parts)
end

#map_value_onto_object(object, key, value) ⇒ Object



7
8
9
10
11
12
# File 'lib/sax_stream/internal/mappings/element.rb', line 7

def map_value_onto_object(object, key, value)
  if value && @parser
    value = @parser.parse(value)
  end
  write_value_to_object object, value
end

#string_value_from_object(object) ⇒ Object



14
15
16
17
18
# File 'lib/sax_stream/internal/mappings/element.rb', line 14

def string_value_from_object(object)
  result = raw_value_from_object(object)
  result = @parser.format(result) if @parser && @parser.respond_to?(:format)
  result.to_s
end