Sha256: e8ecfa7e1b00c6705647298e76652c36e3c7041c15cb006c54f98a753ea8b88c

Contents?: true

Size: 934 Bytes

Versions: 3

Compression:

Stored size: 934 Bytes

Contents

module LibXMLJRuby
  module XML
    class Attr < Node
      class << self
        def from_java(java_obj)
          return nil unless java_obj
          a = allocate
          a.java_obj = java_obj
          a
        end
      end
      
      attr_accessor :java_obj
      
      def initialize(node, name, value, ns = nil)
        self.java_obj = node.java_obj
        java_obj.set_attribute(name, value)
      end
      
      def remove!
        java_obj.owner_element.remove_attribute(name)
      end
      
      def parent?
        !!parent
      end
      
      def parent
        XML::Node.from_java(java_obj.owner_element)
      end
      
      def name
        java_obj.respond_to?(:name) ? java_obj.name : java_obj.node_name
      end
      
      def value
        java_obj.value
      end
      
      def value=(value)
        raise TypeError if value.nil?
        java_obj.value = value
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
libxml-jruby-modified-1.0.2-jruby lib/libxml-jruby/xml/attr.rb
libxml-jruby-modified-1.0.1-jruby lib/libxml-jruby/xml/attr.rb
libxml-jruby-1.0.0 lib/libxml-jruby/xml/attr.rb