Class: Compendium::DateParam

Inherits:
Param
  • Object
show all
Defined in:
lib/compendium/param_types.rb

Instance Method Summary collapse

Methods inherited from Param

#==, #boolean?, #dropdown?, #nil?, #radio?

Constructor Details

#initialize(obj) ⇒ DateParam

Returns a new instance of DateParam.



65
66
67
68
69
70
71
72
73
# File 'lib/compendium/param_types.rb', line 65

def initialize(obj, *)
  if obj.respond_to?(:to_date)
    obj = obj.to_date
  else
    obj = Date.parse(obj) rescue nil
  end

  super obj
end

Instance Method Details

#date?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/compendium/param_types.rb', line 75

def date?
  true
end