Sha256: 1c3c28ff2eb8750e980975e322edeb73a9d07c5997d9d46b915d69913b359dc4

Contents?: true

Size: 612 Bytes

Versions: 1

Compression:

Stored size: 612 Bytes

Contents

# coding: utf-8

require File.join(File.dirname(__FILE__), "core")
require "date"

class Kagemusha #:nodoc:
  module Date #:nodoc:
    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nayutaya-kagemusha-0.1.0 lib/kagemusha/date.rb