Sha256: db899f61fcf970b76c7cb16ee4da06acab2c8d375c48addc4728c00d0e7b192e

Contents?: true

Size: 574 Bytes

Versions: 1

Compression:

Stored size: 574 Bytes

Contents

module Moxml
  class Attribute < Node
    def initialize(name_or_native = nil, value = nil)
      case name_or_native
      when String
        super(adapter.create_attribute(nil, name_or_native, value))
      else
        super(name_or_native)
      end
    end

    def name
      adapter.attribute_name(native)
    end

    def value
      adapter.attribute_value(native)
    end

    def value=(new_value)
      adapter.set_attribute_value(native, new_value)
    end

    private

    def create_native_node
      adapter.create_attribute(nil, "", "")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moxml-0.1.0 lib/moxml/attribute.rb