Module: DayOfTheWeek

Extended by:
ParamsValidator::ValidParams
Defined in:
lib/day-of-the-week.rb,
lib/day-of-the-week/version.rb

Overview

require ‘logger’

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.get_day(params) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/day-of-the-week.rb', line 10

def get_day(params)
  validate_method(params) do
    year(Fixnum){ |year| year <= Time.now.year  }
    month(Fixnum)
    day(Fixnum)
  end
  
  date = Date.new(params[:year], params[:month], params[:day])
  Date::DAYNAMES[date.wday]
end