Class: Date
- Inherits:
-
Object
- Object
- Date
- Defined in:
- lib/wareki/std_ext.rb
Overview
:nodoc:
Constant Summary collapse
- JAPAN =
Wareki::GREGORIAN_START
Class Method Summary collapse
- ._parse(str, comp = true) ⇒ Object
- ._wareki__parse_orig ⇒ Object
- ._wareki_parse_orig ⇒ Object
- .parse(str = '-4712-01-01', comp = true, start = ::Date::ITALY) ⇒ Object
Instance Method Summary collapse
Class Method Details
._parse(str, comp = true) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/wareki/std_ext.rb', line 36 def _parse(str, comp = true) di = Wareki::Date._parse(str) wdate = Wareki::Date.new(di[:era], di[:year], di[:month], di[:day], di[:is_leap]) rescue ArgumentError, Wareki::UnsupportedDateRange ::Date._wareki__parse_orig(str, comp) else ::Date._wareki__parse_orig(str.sub(Wareki::REGEX, wdate.strftime('%F ')), comp) end |
._wareki__parse_orig ⇒ Object
35 |
# File 'lib/wareki/std_ext.rb', line 35 alias _wareki__parse_orig _parse |
._wareki_parse_orig ⇒ Object
28 |
# File 'lib/wareki/std_ext.rb', line 28 alias _wareki_parse_orig parse |
.parse(str = '-4712-01-01', comp = true, start = ::Date::ITALY) ⇒ Object
29 30 31 32 33 |
# File 'lib/wareki/std_ext.rb', line 29 def parse(str = '-4712-01-01', comp = true, start = ::Date::ITALY) Wareki::Date.parse(str).to_date(start) rescue ArgumentError, Wareki::UnsupportedDateRange ::Date._wareki_parse_orig(str, comp, start) end |
Instance Method Details
#_wareki_strftime_orig ⇒ Object
18 |
# File 'lib/wareki/std_ext.rb', line 18 alias _wareki_strftime_orig strftime |
#strftime(format = '%F') ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/wareki/std_ext.rb', line 19 def strftime(format = '%F') if format.index('%J') to_wareki_date.strftime(format) else _wareki_strftime_orig(format) end end |