Class: Lego::Value::Date

Inherits:
Base
  • Object
show all
Defined in:
lib/lego/value/date.rb

Instance Method Summary collapse

Methods inherited from Base

#coerce, #initialize, #parse

Constructor Details

This class inherits a constructor from Lego::Value::Base

Instance Method Details

#parsersObject



4
5
6
7
8
9
# File 'lib/lego/value/date.rb', line 4

def parsers
  [
    ->(v) { Lego.just(v.to_date) rescue Lego.fail("invalid date: '#{v}'") },
    ->(v) { v.nil? ? Lego.none : Lego.just(v) },
  ]
end