class HappyMapper::Attribute

Attributes

default[RW]

Public Class Methods

new(name, type, options = {}) click to toggle source

@see Item#initialize Additional options:

:default => Object The default value for this
Calls superclass method
# File lib/happymapper/attribute.rb, line 10
def initialize(name, type, options = {})
  super
  self.default = options[:default]
end

Public Instance Methods

find(node, _namespace, xpath_options) { |xpath| ... } click to toggle source
# File lib/happymapper/attribute.rb, line 15
def find(node, _namespace, xpath_options)
  if options[:xpath]
    yield(node.xpath(options[:xpath], xpath_options))
  else
    yield(node.attributes[tag])
  end
end