Class: Shellout::Date
- Inherits:
-
Date
- Object
- Date
- Shellout::Date
- Defined in:
- lib/shellout/date.rb
Class Method Summary collapse
Class Method Details
.from_str(date_str, base = Date.today) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/shellout/date.rb', line 6 def self.from_str(date_str, base=Date.today) raise ArgumentError.new("Can't convert nil to a Date") \ if date_str.nil? args = [date_str, base] return parse_str_from_english(*args) \ || parse_str_from_offset(*args) \ || parse_str_from_ymd(*args) \ || (raise ArgumentError.new( "Failed to convert String(#{date_str}) to a Date")) end |