Class: ProcessEngine::Parser::Extension::FormField
- Inherits:
-
Object
- Object
- ProcessEngine::Parser::Extension::FormField
- Defined in:
- app/models/process_engine/parser/extension/form_field.rb
Instance Attribute Summary collapse
-
#element ⇒ Object
readonly
Returns the value of attribute element.
Class Method Summary collapse
Instance Method Summary collapse
- #default_value ⇒ Object
- #id ⇒ Object
-
#initialize(element) ⇒ FormField
constructor
A new instance of FormField.
- #label ⇒ Object
- #properties ⇒ Object
- #to_h ⇒ Object
- #type ⇒ Object
- #validation ⇒ Object
Constructor Details
#initialize(element) ⇒ FormField
Returns a new instance of FormField.
4 5 6 |
# File 'app/models/process_engine/parser/extension/form_field.rb', line 4 def initialize(element) @element = element end |
Instance Attribute Details
#element ⇒ Object (readonly)
Returns the value of attribute element.
2 3 4 |
# File 'app/models/process_engine/parser/extension/form_field.rb', line 2 def element @element end |
Class Method Details
.factory(extension_element) ⇒ Object
47 48 49 |
# File 'app/models/process_engine/parser/extension/form_field.rb', line 47 def self.factory(extension_element) data = extension_element.xpath("camunda:formData//camunda:formField").map{ |ff| new(ff) } end |
Instance Method Details
#default_value ⇒ Object
20 21 22 |
# File 'app/models/process_engine/parser/extension/form_field.rb', line 20 def default_value element["defaultValue"] end |
#id ⇒ Object
8 9 10 |
# File 'app/models/process_engine/parser/extension/form_field.rb', line 8 def id element["id"] end |
#label ⇒ Object
12 13 14 |
# File 'app/models/process_engine/parser/extension/form_field.rb', line 12 def label element["label"] end |
#properties ⇒ Object
24 25 26 27 28 |
# File 'app/models/process_engine/parser/extension/form_field.rb', line 24 def properties element.xpath("camunda:properties//camunda:property").each_with_object({}) do |prop, hash| hash[prop["id"]] = prop["value"] end end |
#to_h ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'app/models/process_engine/parser/extension/form_field.rb', line 36 def to_h { id: id, label: label, type: type, default_value: default_value, properties: properties, validation: validation } end |
#type ⇒ Object
16 17 18 |
# File 'app/models/process_engine/parser/extension/form_field.rb', line 16 def type element["type"] end |
#validation ⇒ Object
30 31 32 33 34 |
# File 'app/models/process_engine/parser/extension/form_field.rb', line 30 def validation element.xpath("camunda:validation//camunda:constraint").each_with_object({}) do |constraint, hash| hash[constraint["name"]] = constraint["config"] end end |