Class: Jquard::Schemas::Fields::Select

Inherits:
Field
  • Object
show all
Defined in:
lib/jquard/schemas/fields/select.rb

Constant Summary

Constants inherited from Field

Field::UNSET

Instance Attribute Summary

Attributes inherited from Field

#name

Instance Method Summary collapse

Methods inherited from Field

#column_span, #column_span_full, #default, #disabled, #disabled?, #helper_text, #initialize, #label, make, #placeholder, #required, #required?

Methods included from ComponentDispatch

#component_class

Constructor Details

This class inherits a constructor from Jquard::Schemas::Fields::Field

Instance Method Details

#choicesObject



12
13
14
# File 'lib/jquard/schemas/fields/select.rb', line 12

def choices
  options.map { |value, label| [ label, value.to_s ] }
end

#options(map = nil) ⇒ Object



5
6
7
8
9
10
# File 'lib/jquard/schemas/fields/select.rb', line 5

def options(map = nil)
  return @options || {} if map.nil?

  @options = map
  self
end