Module: Formtastic::Inputs::Base::Numeric
- Included in:
- NumberInput, RangeInput
- Defined in:
- lib/formtastic/inputs/base/numeric.rb
Instance Method Summary (collapse)
- - (Object) in_option
- - (Object) input_html_options
- - (Object) max_option
- - (Object) min_option
- - (Object) step_option
- - (Object) wrapper_html_options
Instance Method Details
- (Object) in_option
38 39 40 |
# File 'lib/formtastic/inputs/base/numeric.rb', line 38 def in_option [:in] end |
- (Object) input_html_options
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/formtastic/inputs/base/numeric.rb', line 5 def defaults = super # override rails default size - does not apply to numeric inputs #@todo document/spec defaults[:size] = nil if in_option defaults[:min] = in_option.to_a.min defaults[:max] = in_option.to_a.max else defaults[:min] ||= min_option defaults[:max] ||= max_option end defaults[:step] ||= step_option defaults end |
- (Object) max_option
33 34 35 36 |
# File 'lib/formtastic/inputs/base/numeric.rb', line 33 def max_option return [:max] if .key?(:max) validation_max end |
- (Object) min_option
28 29 30 31 |
# File 'lib/formtastic/inputs/base/numeric.rb', line 28 def min_option return [:min] if .key?(:min) validation_min end |
- (Object) step_option
23 24 25 26 |
# File 'lib/formtastic/inputs/base/numeric.rb', line 23 def step_option return [:step] if .key?(:step) validation_step end |
- (Object) wrapper_html_options
42 43 44 45 |
# File 'lib/formtastic/inputs/base/numeric.rb', line 42 def new_class = [super[:class], "numeric", "stringish"].compact.join(" ") super.merge(:class => new_class) end |