Class: XForms::Control
Instance Attribute Summary collapse
-
#binding ⇒ Object
Returns the value of attribute binding.
-
#constraint ⇒ Object
Returns the value of attribute constraint.
-
#constraint_message ⇒ Object
Returns the value of attribute constraint_message.
-
#form ⇒ Object
Returns the value of attribute form.
-
#readonly ⇒ Object
Returns the value of attribute readonly.
-
#relevant ⇒ Object
Returns the value of attribute relevant.
Attributes included from Label
Instance Method Summary collapse
-
#initialize(form) ⇒ Control
constructor
A new instance of Control.
- #relevant? ⇒ Boolean
- #valid? ⇒ Boolean
- #value ⇒ Object
- #value=(value) ⇒ Object
Constructor Details
#initialize(form) ⇒ Control
Returns a new instance of Control.
42 43 44 45 |
# File 'lib/xforms/control.rb', line 42 def initialize(form) @form = form @readonly = false end |
Instance Attribute Details
#binding ⇒ Object
Returns the value of attribute binding.
35 36 37 |
# File 'lib/xforms/control.rb', line 35 def binding @binding end |
#constraint ⇒ Object
Returns the value of attribute constraint.
37 38 39 |
# File 'lib/xforms/control.rb', line 37 def constraint @constraint end |
#constraint_message ⇒ Object
Returns the value of attribute constraint_message.
38 39 40 |
# File 'lib/xforms/control.rb', line 38 def @constraint_message end |
#form ⇒ Object
Returns the value of attribute form.
34 35 36 |
# File 'lib/xforms/control.rb', line 34 def form @form end |
#readonly ⇒ Object
Returns the value of attribute readonly.
36 37 38 |
# File 'lib/xforms/control.rb', line 36 def readonly @readonly end |
#relevant ⇒ Object
Returns the value of attribute relevant.
39 40 41 |
# File 'lib/xforms/control.rb', line 39 def relevant @relevant end |
Instance Method Details
#relevant? ⇒ Boolean
65 66 67 68 |
# File 'lib/xforms/control.rb', line 65 def relevant? return true unless @relevant @relevant.dyn_value end |
#valid? ⇒ Boolean
59 60 61 62 63 |
# File 'lib/xforms/control.rb', line 59 def valid? return true unless constraint node = form.model_instance.xpath(binding).first node.xpath(constraint) == true end |
#value ⇒ Object
51 52 53 |
# File 'lib/xforms/control.rb', line 51 def value form.model_instance.xpath(binding).first.inner_text end |
#value=(value) ⇒ Object
47 48 49 |
# File 'lib/xforms/control.rb', line 47 def value=(value) form.model_instance.xpath(binding).first.children = value end |