Sha256: 122ffcdcbdc3c295ec1e430ec9164291a41f86d9a51ee14cb34ea026b0d72351

Contents?: true

Size: 461 Bytes

Versions: 8

Compression:

Stored size: 461 Bytes

Contents

module HappyMapper
  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

8 entries across 8 versions & 4 rubygems

Version Path
nokogiri-happymapper-0.6.0 lib/happymapper/attribute.rb
xmlmapper-0.5.9 lib/happymapper/attribute.rb
instructure-happymapper-0.5.10 lib/happymapper/attribute.rb
nokogiri-happymapper-deiga-0.5.10 lib/happymapper/attribute.rb
nokogiri-happymapper-deiga-0.5.9 lib/happymapper/attribute.rb
nokogiri-happymapper-0.5.9 lib/happymapper/attribute.rb
nokogiri-happymapper-0.5.8 lib/happymapper/attribute.rb
nokogiri-happymapper-0.5.7 lib/happymapper/attribute.rb