Module: Kagemusha::Date

Defined in:
lib/kagemusha/date.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.on(date_or_year, mon = 1, mday = 1, &block) ⇒ Object

:nodoc:



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/kagemusha/date.rb', line 8

def self.on(date_or_year, mon = 1, mday = 1, &block) #:nodoc:
  if block_given?
    return self.on(date_or_year, mon, mday).swap(&block)
  end

  date =
    case date_or_year
    when ::Date    then date_or_year
    when ::Integer then ::Date.new(date_or_year, mon, mday)
    else raise(ArgumentError, "?") # FIXME: message
    end

  musha = Kagemusha.new(::Date)
  musha.defs(:today) { date }

  return musha
end