Class: REDCap::Form::Field
- Inherits:
-
Struct
- Object
- Struct
- REDCap::Form::Field
- Defined in:
- lib/red_cap/form/fields.rb
Direct Known Subclasses
Descriptive, File, RadioButtons, Sql, Text, Yesno
Constant Summary collapse
- KEYS =
[ :field_name, :form_name, :section_header, :field_type, :field_label, :select_choices_or_calculations, :field_note, :text_validation_type_or_show_slider_number, :text_validation_min, :text_validation_max, :identifier, :branching_logic, :required_field, :custom_alignment, :question_number, :matrix_group_name, :matrix_ranking, :field_annotation, ].each do |key| define_method key do attributes[key.to_s] end end
Instance Attribute Summary collapse
-
#associated_fields ⇒ Object
Returns the value of attribute associated_fields.
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#method_missing(method, *args, **kwargs, &block) ⇒ Object
field type inquiry methods.
- #value(responses) ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, **kwargs, &block) ⇒ Object
field type inquiry methods
36 37 38 39 40 41 42 |
# File 'lib/red_cap/form/fields.rb', line 36 def method_missing method, *args, **kwargs, &block if method.to_s.ends_with?("?") field_type == method.to_s.chomp("?") else super end end |
Instance Attribute Details
#associated_fields ⇒ Object
Returns the value of attribute associated_fields
5 6 7 |
# File 'lib/red_cap/form/fields.rb', line 5 def associated_fields @associated_fields end |
#attributes ⇒ Object
Returns the value of attribute attributes
5 6 7 |
# File 'lib/red_cap/form/fields.rb', line 5 def attributes @attributes end |
#options ⇒ Object
Returns the value of attribute options
5 6 7 |
# File 'lib/red_cap/form/fields.rb', line 5 def end |
Instance Method Details
#value(responses) ⇒ Object
31 32 33 |
# File 'lib/red_cap/form/fields.rb', line 31 def value responses responses[field_name] end |