Module: Plum::FieldOptions
- Defined in:
- app/services/plum/field_options.rb
Class Method Summary collapse
Class Method Details
.editor_value(options) ⇒ Object
17 18 19 |
# File 'app/services/plum/field_options.rb', line 17 def editor_value() pairs().map { |label, value| label == value ? label : "#{label} | #{value}" }.join("\n") end |
.pairs(options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/services/plum/field_options.rb', line 5 def pairs() Array().filter_map do |option| if option.is_a?(Hash) value = option["value"] || option[:value] label = option["label"] || option[:label] || value [ label.to_s, value.to_s ] if value.present? elsif option.present? [ option.to_s, option.to_s ] end end end |