Sha256: 164564d2a82189c1edb664402fb49e49f4b8e743e86afb0a07971392cefeb6b9

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

# coding: utf-8

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.1.0 lib/kagemusha/time.rb