Sha256: a84638a9ff99f84d62c5fc55b59269d87ce63ea4b6d2ea4a92343d50e4c4f0ad

Contents?: true

Size: 459 Bytes

Versions: 12

Compression:

Stored size: 459 Bytes

Contents

module XmlMapper
  class Attribute < Item
    attr_accessor :default

    # @see Item#initialize
    # Additional options:
    #   :default => Object The default value for this
    def initialize(name, type, o={})
      super
      self.default = o[:default]
    end

    def find(node, namespace, xpath_options)
      if options[:xpath]
        yield(node.xpath(options[:xpath],xpath_options))
      else
        yield(node[tag])
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
xmlmapper-0.8.1 lib/xmlmapper/attribute.rb
xmlmapper-0.8.0 lib/xmlmapper/attribute.rb
xmlmapper-0.7.3 lib/xmlmapper/attribute.rb
xmlmapper-0.7.2 lib/xmlmapper/attribute.rb
xmlmapper-0.7.1 lib/xmlmapper/attribute.rb
xmlmapper-0.7.0 lib/xmlmapper/attribute.rb
xmlmapper-0.6.5 lib/xmlmapper/attribute.rb
xmlmapper-0.6.4 lib/xmlmapper/attribute.rb
xmlmapper-0.6.3 lib/xmlmapper/attribute.rb
xmlmapper-0.6.2 lib/xmlmapper/attribute.rb
xmlmapper-0.6.1 lib/xmlmapper/attribute.rb
xmlmapper-0.6.0 lib/xmlmapper/attribute.rb