Class: OpenRosa::Fields::Range

Inherits:
Base
  • Object
show all
Defined in:
lib/open_rosa/fields/range.rb

Overview

Range field for numeric sliders/pickers Maps to XForms element Data type: int or decimal

Constant Summary collapse

VALID_TYPES =
i[int decimal].freeze

Instance Attribute Summary collapse

Attributes inherited from Base

#default, #hint, #label, #name, #required

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Range

Returns a new instance of Range.



13
14
15
16
17
18
19
20
21
# File 'lib/open_rosa/fields/range.rb', line 13

def initialize(name, options = {})
  super
  @start = options[:start]
  @end = options[:end]
  @step = options.fetch(:step, 1)
  @type = options.fetch(:type, :int)

  validate!
end

Instance Attribute Details

#endObject (readonly)

Returns the value of attribute end.



9
10
11
# File 'lib/open_rosa/fields/range.rb', line 9

def end
  @end
end

#startObject (readonly)

Returns the value of attribute start.



9
10
11
# File 'lib/open_rosa/fields/range.rb', line 9

def start
  @start
end

#stepObject (readonly)

Returns the value of attribute step.



9
10
11
# File 'lib/open_rosa/fields/range.rb', line 9

def step
  @step
end

#typeObject (readonly)

Returns the value of attribute type.



9
10
11
# File 'lib/open_rosa/fields/range.rb', line 9

def type
  @type
end