Class: REXML::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/xmpp4r/rexmladdons.rb

Instance Method Summary collapse

Constructor Details

#initialize(first, second = nil, parent = nil) ⇒ Attribute


864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
# File 'lib/xmpp4r/rexmladdons.rb', line 864

def initialize( first, second=nil, parent=nil )
	@normalized = @unnormalized = @element = nil
	if first.kind_of? Attribute
		self.name = first.expanded_name
		@value = first.value
		if second.kind_of? Element
			@element = second
		else
			@element = first.element
		end
	elsif first.kind_of? String
		@element = parent if parent.kind_of? Element
		self.name = first
		@value = Text::normalize(second.to_s)
	else
		raise "illegal argument #{first.class.name} to Attribute constructor"
	end
end