module Birthgem

This module lets you know the birstone(s) for an entered birthday.

Constants

STONE_BY_MONTH

The birthstones are selected according to [International Gem Society](www.gemsociety.org/article/birthstone-chart/).

VERSION

Public Class Methods

stone(date) click to toggle source

Outputs the birthstone(s) of the month for the date in the argument.

# File lib/birthgem.rb, line 30
def self.stone(date)
  key =
    if date.instance_of?(Integer)
      date
    elsif date.instance_of?(String)
      parsed_date = Date.parse(date)
      parsed_date.month
    elsif date.instance_of?(Date)
      date.month
    end
  STONE_BY_MONTH[key] unless key.nil?
end