Module: Zodiac::Finder
- Defined in:
- lib/zodiac/finder.rb
Constant Summary collapse
- YEAR =
2011
- RANGES =
{ range_for(1, 1, 1, 20) => :capricorn, range_for(1, 21, 2, 19) => :aquarius, range_for(2, 20, 3, 20) => :pisces, range_for(3, 21, 4, 20) => :aries, range_for(4, 21, 5, 21) => :taurus, range_for(5, 22, 6, 21) => :gemini, range_for(6, 22, 7, 22) => :cancer, range_for(7, 23, 8, 21) => :leo, range_for(8, 22, 9, 23) => :virgo, range_for(9, 24, 10, 23) => :libra, range_for(10, 24, 11, 22) => :scorpio, range_for(11, 23, 12, 22) => :sagittarius, range_for(12, 23, 12, 31) => :capricorn }
- SIGN_IDS =
{ :aries => 1, :taurus => 2, :gemini => 3, :cancer => 4, :leo => 5, :virgo => 6, :libra => 7, :scorpio => 8, :sagittarius => 9, :capricorn => 10, :aquarius => 11, :pisces => 12 }
Class Method Summary collapse
- .date_for(month, day) ⇒ Object
- .range_for(month_start, day_start, month_end, day_end) ⇒ Object
- .sign_for(date) ⇒ Object
- .sign_id_for(date) ⇒ Object
Class Method Details
.date_for(month, day) ⇒ Object
6 7 8 |
# File 'lib/zodiac/finder.rb', line 6 def date_for(month, day) DateTime.new(YEAR, month, day) end |
.range_for(month_start, day_start, month_end, day_end) ⇒ Object
10 11 12 13 |
# File 'lib/zodiac/finder.rb', line 10 def range_for(month_start, day_start, month_end, day_end) start, ending = date_for(month_start, day_start), date_for(month_end, day_end) SimpleRange.new(start, ending) end |
.sign_for(date) ⇒ Object
47 48 49 |
# File 'lib/zodiac/finder.rb', line 47 def self.sign_for(date) I18n.t!("zodiac.#{self.sign_symbol_for date}") end |
.sign_id_for(date) ⇒ Object
51 52 53 |
# File 'lib/zodiac/finder.rb', line 51 def self.sign_id_for(date) SIGN_IDS[self.sign_symbol_for date] end |