class XML::Smart::Dom::AttributeSet
Public Class Methods
Source
# File lib/xml/smart_domattributeset.rb, line 8 def initialize(element) @element = element @set = @element.attributes end
Public Instance Methods
Source
# File lib/xml/smart_domattributeset.rb, line 24 def [](name,attr=false) return nil unless has_attr?(name) if attr == false @element.attribute(name).value else Attribute.new(@element.attribute(name)) end end
Source
# File lib/xml/smart_domattributeset.rb, line 32 def []=(name,value); @element[name] = value end
Source
# File lib/xml/smart_domattributeset.rb, line 38 def delete_all!; @set.each { |k,a| a.remove }; end
Source
# File lib/xml/smart_domattributeset.rb, line 48 def delete_at!(name) tmp = @set[name] if tmp.is_a?(Nokogiri::XML::Attr) tmp.remove true else false end end
Source
# File lib/xml/smart_domattributeset.rb, line 58 def delete_if!(&block) return self if block.nil? @set.each do |k,node| node.remove if block.call(Dom::smart_helper(node)) end self end
Source
# File lib/xml/smart_domattributeset.rb, line 40 def each(&block) return self if block.nil? @set.each do |k,node| block.call Dom::smart_helper(node) end self end
Source
# File lib/xml/smart_domattributeset.rb, line 19 def has_attr?(a); @set.has_key?(a) end