Created
August 27, 2013 16:20
-
-
Save mindreframer/6355716 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Zodiac | |
SIGNS = [ | |
[:aries, [21,3,20,4]], | |
[:taurus, [21,4,20,5]], | |
[:gemini, [21,5,20,6]], | |
[:cancer, [21,6,22,7]], | |
[:leo, [23,7,22,8]], | |
[:virgo, [23,8,22,9]], | |
[:libra, [23,9,22,10]], | |
[:scorpio, [23,10,21,11]], | |
[:sagittarius, [22,11,21,12]], | |
[:capricorn, [22,12,19,1]], | |
[:aquarius, [20,1,18,2]], | |
[:pisces, [19,2,20,3]] | |
] | |
ZODIAC_GEMS={ | |
:en => { | |
:aries => "Bloodstone,Diamond,Jasper,Bloodstone,Diamond,Jasper", | |
:taurus => "Amber,Blood Coral,Emerald,Sapphire,Turquoise Aventurine,Emerald,Diamond,Sapphire", | |
:gemini => "Agate,Chrysoprase,Pearl,Tiger Eye,Agate,Emerald", | |
:cancer => "Emerald,Moonstone,Pearl,Ruby,Moonstone,Agate,Chalcedony,Emerald", | |
:leo => "Onyx,Sardonyx,Tourmaline,Rock Crystal,Amber,Onyx,Peridot", | |
:virgo => "Carnelian,Jade,Jasper,Sapphire,Citrine,Carnelian,Sardonyx", | |
:libra => "Lapis Lazuli,Opal,Peridot,Sapphire,Opal,Chrsolite,Sardonyx", | |
:scorpio => "Aquamarine,Topaz,Garnet,Ruby,Aquamarine,Beryl", | |
:sagittarius => "Amethyst,Sapphire,Topaz,Turquoise,Topaz,Pearl,Topaz", | |
:capricorn => "Agate,Garnet,Ruby,Lapis,Lazuli,Ruby", | |
:aquarius => "Amethyst,Garnet,Moss Agate,Opal,Turquoise,Garnet Hyacinth", | |
:pisces => "Amethyst,Bloodstone,Rock Crystal,Sapphire", | |
}, | |
# http://www.suite101.de/content/die-sternzeichen-steine-a70023 | |
:de => { | |
:aries => "Amethyst,Calcit,Hämatit,Katzenauge,Rhodonit,Tigereisen,Rosenquarz,Unakit,Roter Jaspis,Landschaftsjaspis", | |
:taurus => "Amazonit,Onyx,Koralle,Aventurin,Rhodonit,Jade,Roter Jaspis,Selenit,Rosenquarz,Smaragdquarz", | |
:gemini => "Bergkristall,Dalmatinerjaspis,Tigerauge,Jaspis,Katzenauge,Leopardenjaspis,Landschaftsjaspis,Roter Jaspis,Onyx,Unakit", | |
:cancer => "Aventurin,Sonnenstein,Saphirquarz,Rosenquarz,Jade,Howlith,Smaragdquarz,Rhodonit,Calcit,Onyx", | |
:leo => "Onyx,Calcit,Leopardenjaspis,Tigerauge,Aventurin,Brekzienjaspis,Dalmatinerjaspis,Unakit,Bergkristall,Koralle", | |
:virgo => "Dalmatinerjaspis,Amethyst,Leopardenjaspis,Koralle,Calcit,Tigerauge mit Hämatit (Tigereisen),Landschaftsjaspis,Unakit,Howlith,Tigerauge", | |
:libra => "Rosenquarz,Obsidian,Amazonit,Tigerauge,Howlith,Koralle,Jade,Rauchquarz,Unakit,Aventurin", | |
:scorpio => "Koralle,Tigerauge,Dalmatinerjaspis,Leopardenjaspis,Howlith,Hämatit,Rhodonit,Fluorit,Obsidian,Brekzienjaspis", | |
:sagittarius => "Zebraachat,Unakit,Rhodonit,Aventurin,Leopardenjaspis,Sodalith,Howlith,Obsidian,Sonnenstein,Amethyst", | |
:capricorn => "Amethyst,Aventurin,Bergkristall,Dalmatinerjaspis,Katzenauge,Rosenquarz,Sodalith,Onyx,Koralle,Zebraachat", | |
:aquarius => "Amazonit,Amethyst,Unakit,Hämatit,Jade,Roter Jaspis,Tigerauge,Sodalith,Rhodonit,Koralle", | |
:pisces => "Amazonit,Bergkristall,Fluorit,Smaradquarz,Calcit,Roter Jaspis,Onyx,Landschaftsjaspis,Leopardenjaspis,Rhodonit", | |
}, | |
:fr =>{ | |
:aries => [], | |
:taurus => [], | |
:gemini => [], | |
:cancer => [], | |
:leo => [], | |
:virgo => [], | |
:libra => [], | |
:scorpio => [], | |
:sagittarius => [], | |
:capricorn => [], | |
:aquarius => [], | |
:pisces => [], | |
} | |
} | |
def self.get_sign(date_time) | |
month = date_time.month | |
day = date_time.day | |
v = nil | |
SIGNS.each do |s| | |
sign = s[0] | |
range = s[1] | |
v = sign if in_range(month, day, range) | |
end | |
v | |
end | |
def self.in_range(month, day, range) | |
d = Time.utc(1960, month, day) | |
lower = Time.utc(1960, range[1],range[0]) | |
upper = Time.utc(1960, range[3],range[2]) | |
if upper.month == 1 && upper.day <= 20 | |
lower = Time.utc(1959, lower.month, lower.day) | |
end | |
if d.month == 12 && d.day >= 22 | |
d = Time.utc(1959, d.month, d.day) | |
end | |
(d >= lower) && (d <= upper) | |
end | |
def self.gems_for_sign(sign, locale='en') | |
ZODIAC_GEMS[locale.to_sym][sign.to_sym].split(',') | |
end | |
end | |
# puts Zodiac.in_range(1,20, [20, 1, 18, 2]) | |
# puts Zodiac.in_range(1,20, [21, 1, 18, 2]) | |
# puts Zodiac.in_range(12,30, [22, 12, 19, 1]) | |
# | |
# puts Zodiac.get_sign(Time.utc(1979,12,30)) # == :capricorn | |
# puts Zodiac.get_sign(Time.utc(1979,3,28))# | |
puts Zodiac.gems_for_sign(Zodiac.get_sign(Time.utc(1979,8,31)), 'de') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment