Class: REDCap::Form::RadioButtons

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

Direct Known Subclasses

Checkboxes, Dropdown

Constant Summary

Constants inherited from Field

Field::KEYS

Instance Attribute Summary

Attributes inherited from Field

#associated_fields, #attributes

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



85
86
87
88
89
90
91
92
# File 'lib/red_cap/form/fields.rb', line 85

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

#value(responses) ⇒ Object



81
82
83
# File 'lib/red_cap/form/fields.rb', line 81

def value responses
  options[super]
end