Class: Melitta::Coercers::MonthYear
- Inherits:
-
Struct
- Object
- Struct
- Melitta::Coercers::MonthYear
- Defined in:
- lib/melitta/coercers.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
Returns the value of attribute input.
Instance Method Summary collapse
Instance Attribute Details
#input ⇒ Object
Returns the value of attribute input
95 96 97 |
# File 'lib/melitta/coercers.rb', line 95 def input @input end |
Instance Method Details
#output ⇒ Object
103 104 105 106 107 108 |
# File 'lib/melitta/coercers.rb', line 103 def output month = input.scan(/\b(?:0?[1-9]|1[012])\b/)[0].to_i year = input.scan(/\b\d{4}\b/)[0].to_i ::Date.new(year, month) end |