Class: Tableficate::Filter::InputRange

Inherits:
Base
  • Object
show all
Defined in:
lib/tableficate/filters/input_range.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#attrs, #field_name, #label, #label_options, #name, #table, #template

Instance Method Summary collapse

Methods inherited from Base

#field_value

Constructor Details

#initialize(table, name, options = {}) ⇒ InputRange

Returns a new instance of InputRange.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/tableficate/filters/input_range.rb', line 38

def initialize(table, name, options = {})
  start_options = options.delete(:start) || {}
  stop_options  = options.delete(:stop)  || {}

  super(table, name, options)

  start_options.reverse_merge!(@attrs)
  start_options.reverse_merge!(label: self.label, label_options: self.label_options)
  stop_options.reverse_merge!(@attrs)
  stop_options.reverse_merge!(label: self.label, label_options: self.label_options)

  @start = InputStart.new(table, name, start_options)
  @stop  = InputStop.new(table, name, stop_options)

  new_partial = "filters/input_range_#{@attrs[:type]}"
  @template = new_partial if table.template.lookup_context.exists?(Tableficate::Utils::template_path(table.template, new_partial, table.theme), [], true)
end

Instance Attribute Details

#startObject (readonly)

Returns the value of attribute start.



36
37
38
# File 'lib/tableficate/filters/input_range.rb', line 36

def start
  @start
end

#stopObject (readonly)

Returns the value of attribute stop.



36
37
38
# File 'lib/tableficate/filters/input_range.rb', line 36

def stop
  @stop
end