Sha256: bf63bae72305e6f08ca48d1326944002cc8ec62e6482fe8341ca3395196ceae8

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# coding: utf-8

#==============================================================================#
# $Id: time.rb 108 2009-02-09 06:04:39Z 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
nayutaya-kagemusha-0.0.9 lib/kagemusha/time.rb