Module: AwesomeXML::NativeType

Included in:
DateTime, Duration, Float, Integer, Text
Defined in:
lib/awesome_xml/native_type.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
# File 'lib/awesome_xml/native_type.rb', line 7

def self.included(base)
  base.class_eval do
    base.extend(AwesomeXML::NativeType::ClassMethods)
  end
end

Instance Method Details

#evaluateObject

This method returns the parsed value of the given node (obtained by calling ‘#text` on it) according to the implementation of the private method `#parse_value` defined in every native type class.



24
25
26
# File 'lib/awesome_xml/native_type.rb', line 24

def evaluate
  @value ||= with_defaults { parse_value }
end

#initialize(string, options) ⇒ Object

Native type instances are initialized with a ‘Nokogiri::XML` object and an options hash.



17
18
19
20
# File 'lib/awesome_xml/native_type.rb', line 17

def initialize(string, options)
  @string = string
  @options = options
end