Class: ActiveElement::Components::Util::NumericField

Inherits:
Object
  • Object
show all
Defined in:
lib/active_element/components/util/numeric_field.rb

Overview

Provides options for a ‘<input type=“number” />` element based on database column properties.

Instance Method Summary collapse

Constructor Details

#initialize(field:, column:) ⇒ NumericField

Returns a new instance of NumericField.



8
9
10
11
# File 'lib/active_element/components/util/numeric_field.rb', line 8

def initialize(field:, column:)
  @field = field
  @column = column
end

Instance Method Details

#optionsObject



13
14
15
16
17
18
19
# File 'lib/active_element/components/util/numeric_field.rb', line 13

def options
  {
    step: step,
    min: min,
    max: max
  }.compact
end