Class: OpenRosa::Fields::Input
- Defined in:
- lib/open_rosa/fields/input.rb
Overview
Input field for text, numbers, dates, and other basic input types
Constant Summary collapse
- VALID_TYPES =
i[ string int decimal date time dateTime geopoint geotrace geoshape binary intent ].freeze
- REGEX_CALL =
Matches regex() calls with single- or double-quoted patterns
/regex\s*\(/- REGEX_WITH_PATTERN =
/regex\s*\(\s*[^,]+,\s*(?:'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)")\s*\)/
Instance Attribute Summary collapse
-
#constraint ⇒ Object
readonly
Returns the value of attribute constraint.
-
#constraint_message ⇒ Object
readonly
Returns the value of attribute constraint_message.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Base
#default, #hint, #label, #name, #required
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Input
constructor
A new instance of Input.
Constructor Details
#initialize(name, options = {}) ⇒ Input
Returns a new instance of Input.
18 19 20 21 22 23 24 25 |
# File 'lib/open_rosa/fields/input.rb', line 18 def initialize(name, = {}) super @type = .fetch(:type, :string) @constraint = [:constraint] = [:constraint_message] validate! end |
Instance Attribute Details
#constraint ⇒ Object (readonly)
Returns the value of attribute constraint.
7 8 9 |
# File 'lib/open_rosa/fields/input.rb', line 7 def constraint @constraint end |
#constraint_message ⇒ Object (readonly)
Returns the value of attribute constraint_message.
7 8 9 |
# File 'lib/open_rosa/fields/input.rb', line 7 def end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/open_rosa/fields/input.rb', line 7 def type @type end |