Class: XForms::Form
Instance Attribute Summary collapse
-
#calculates ⇒ Object
Returns the value of attribute calculates.
-
#controls ⇒ Object
Returns the value of attribute controls.
-
#itext ⇒ Object
Returns the value of attribute itext.
-
#model_instance ⇒ Object
Returns the value of attribute model_instance.
-
#namespaces ⇒ Object
Returns the value of attribute namespaces.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Form
constructor
A new instance of Form.
- #recalculate ⇒ Object
Constructor Details
#initialize ⇒ Form
Returns a new instance of Form.
9 10 11 12 13 |
# File 'lib/xforms/form.rb', line 9 def initialize @controls = [] @namespaces = {} @calculates = [] end |
Instance Attribute Details
#calculates ⇒ Object
Returns the value of attribute calculates.
7 8 9 |
# File 'lib/xforms/form.rb', line 7 def calculates @calculates end |
#controls ⇒ Object
Returns the value of attribute controls.
5 6 7 |
# File 'lib/xforms/form.rb', line 5 def controls @controls end |
#itext ⇒ Object
Returns the value of attribute itext.
4 5 6 |
# File 'lib/xforms/form.rb', line 4 def itext @itext end |
#model_instance ⇒ Object
Returns the value of attribute model_instance.
3 4 5 |
# File 'lib/xforms/form.rb', line 3 def model_instance @model_instance end |
#namespaces ⇒ Object
Returns the value of attribute namespaces.
6 7 8 |
# File 'lib/xforms/form.rb', line 6 def namespaces @namespaces end |
Class Method Details
.parse(input) ⇒ Object
21 22 23 |
# File 'lib/xforms/form.rb', line 21 def self.parse(input) FormParser.new(input).parse end |
.parse_file(path) ⇒ Object
15 16 17 18 19 |
# File 'lib/xforms/form.rb', line 15 def self.parse_file(path) File.open(path, 'r') do |f| parse f end end |
Instance Method Details
#recalculate ⇒ Object
25 26 27 28 29 30 |
# File 'lib/xforms/form.rb', line 25 def recalculate calculates.each do |calc| value = calc[:value].dyn_value model_instance.xpath(calc[:binding]).first.children = value.to_s end end |