Class: LunarCalendar::Solar
Overview
The Solar Calendar Date
Instance Attribute Summary
Attributes inherited from Date
Instance Method Summary collapse
-
#to_i ⇒ Number
rubocop:disable Metrics/AbcSize.
-
#to_lunar ⇒ LunarCalendar::Lunar
The lunar date.
Methods inherited from Date
#<=>, #==, #binary, #initialize
Constructor Details
This class inherits a constructor from LunarCalendar::Date
Instance Method Details
#to_i ⇒ Number
rubocop:disable Metrics/AbcSize
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/lunar_calendar/solar.rb', line 20 def to_i m = (@month + 9) % 12 y = @year - (m / 10) (365 * y) + # One year have 365 days (y / 4) - # Add leap days (y / 100) + (y / 400) + ((m * 306 + 5) / 10) + # Unknown (@day - 1) end |
#to_lunar ⇒ LunarCalendar::Lunar
Returns the lunar date.
12 13 14 |
# File 'lib/lunar_calendar/solar.rb', line 12 def to_lunar LunarCalendar::Calculator::Lunar.new(self).perform end |