Class: EimXML::XHTML::FORM

Inherits:
Simple_ show all
Defined in:
lib/eim_xml/xhtml.rb

Constant Summary

Constants inherited from Element

Element::NEST

Instance Attribute Summary

Attributes inherited from Element

#attributes, #contents, #name

Instance Method Summary collapse

Methods inherited from Element

#==, #[], #add, #add_attribute, #del_attribute, #find, #has?, #match, #name_and_attributes, #pcstring_contents, #write_to

Constructor Details

#initialize(attributes = {}) ⇒ FORM

Returns a new instance of FORM.



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/eim_xml/xhtml.rb', line 54

def initialize(attributes={})
	if attributes
		if s = attributes.delete(:session)
			name = attributes.delete(:session_name) || "token"
			require "digest/sha1"
			token = s[name] ||= Digest::SHA1.hexdigest("#{$$}#{Time.now}#{rand}")
		end
	end
	super
	add(HIDDEN.new(:name=>name, :value=>token)) if token
end