Sha256: 5398a39e1092c8a00a0d3f0b619433dd346e0f8f71cbbc3fe8204dd05ba38b31

Contents?: true

Size: 656 Bytes

Versions: 4

Compression:

Stored size: 656 Bytes

Contents

require 'date'

class Month
  # gather the modules
  include SmartMonth::Calculations
  include SmartMonth::Collection
  include SmartMonth::Math
  include SmartMonth::Util
  include SmartMonth::Magic
  # abstraction that returns an array of months.
  NAMES = Date::MONTHNAMES
  # abstraction that returns an array of day names.
  DAYS = Date::DAYNAMES  
  # constructor, takes 2 optional arguments, if you don't provide them, it will default to
  # the current month and year.
  def initialize(month = Time.now.mon, year = Time.now.year)
    @date = Date.new(year,( month.is_a?(Integer) ? month : Month::NAMES.index(month.to_s.capitalize) ) ,1) 
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rmoriz-smartmonth-1.0.2 lib/month.rb
rmoriz-smartmonth-1.0 lib/month.rb
rmoriz-smartmonth-1.01 lib/month.rb
rmoriz-smartmonth-1.1.1 lib/month.rb