Sha256: 9e36c3d0c730b7fb5b4f14038c5257929012cdf6ca88e6c9fa777678d883637e

Contents?: true

Size: 818 Bytes

Versions: 7

Compression:

Stored size: 818 Bytes

Contents

module XML
  module Smart
    class Dom

      class Attribute
        def initialize(attr)
          @node = attr
        end

        def ===(cls); self.is_a? cls; end

        def to_s; @node.content; end
        def to_i; @node.content.to_i; end
        def to_f; @node.content.to_f; end

        def qname; QName.new @node; end
        def path; @node.path; end

        def value;  @node.content; end;
        def value=(val); @node.content = val; end;

        def ==(other)
          return false unless other
          return false unless other.respond_to?(:unique_id)
          unique_id == other.unique_id
        end
        def unique_id; @node.pointer_id; end

        def parent; Dom::smart_helper(@node.parent); end

        alias :text :value
        alias :text= :value=
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
xml-smart-0.5.3 lib/xml/smart_domattribute.rb
xml-smart-0.5.2 lib/xml/smart_domattribute.rb
xml-smart-0.5.1 lib/xml/smart_domattribute.rb
xml-smart-0.5.0 lib/xml/smart_domattribute.rb
xml-smart-0.4.4 lib/xml/smart_domattribute.rb
xml-smart-0.4.3 lib/xml/smart_domattribute.rb
xml-smart-0.4.2 lib/xml/smart_domattribute.rb