Sha256: 6645f13dc42c78c0d87f167ba3b4631cafa18c946cd86ba6ba7b1523f227d471

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# coding: utf-8

#==============================================================================#
# $Id: time.rb 120 2009-02-09 08:22:25Z yuyakato $
#==============================================================================#

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

#==============================================================================#

class Kagemusha #:nodoc:
  module Time #:nodoc:
    def self.at(time_or_year, mon = 1, mday = 1, hour = 0, min = 0, sec = 0, &block)
      if block_given?
        return self.at(time_or_year, mon, mday, hour, min, sec).swap(&block)
      end

      time =
        case time_or_year
        when ::Time    then time_or_year
        when ::Integer then ::Time.local(time_or_year, mon, mday, hour, min, sec)
        else raise(ArgumentError, "?") # FIXME: message
        end

      musha = Kagemusha.new(::Time)
      musha.defs(:now) { time }

      return musha
    end
  end
end

#==============================================================================#
#==============================================================================#

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kagemusha-0.0.8 lib/kagemusha/time.rb