Class: REDCap::Form::RadioButtons

Inherits:
Field
  • Object
show all
Defined in:
lib/red_cap/form/fields.rb

Direct Known Subclasses

Checkboxes

Constant Summary

Constants inherited from Field

Field::KEYS

Instance Attribute Summary

Attributes inherited from Field

#attributes, #form, #responses

Instance Method Summary collapse

Methods inherited from Field

#method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class REDCap::Form::Field

Instance Method Details

#optionsObject



78
79
80
81
82
83
84
85
# File 'lib/red_cap/form/fields.rb', line 78

def options
  select_choices_or_calculations
    .split(/\s*\|\s*/)
    .reduce({}) do |options, pair|
      _, key, value = *pair.match(/\A(\d+),(.+)\z/)
      options.merge key => value
    end
end

#valueObject



74
75
76
# File 'lib/red_cap/form/fields.rb', line 74

def value
  options[responses[field_name]]
end