Sha256: 77c5506075cc853b52a18828f8f61f9403fd046ee04a8069363fde1f251a9b17

Contents?: true

Size: 816 Bytes

Versions: 1

Compression:

Stored size: 816 Bytes

Contents

# coding: utf-8
# $Id: datetime.rb 108 2009-02-09 06:04:39Z yuyakato $

require "rubygems"
require "kagemusha/datetime"

p Date.today.strftime("%Y-%m-%d") #=> today
p Time.now                        #=> now
puts "---"

# Normal Style.
musha = Kagemusha::DateTime.at(1984, 5, 11, 5, 15, 30)
musha.swap {
  p Date.today.strftime("%Y-%m-%d") #=> 1984-05-11
  p Time.now                        #=> 1984-05-11 05:15:30
  puts "---"
}

p Date.today.strftime("%Y-%m-%d") #=> today
p Time.now                        #=> now
puts "---"

# Block Style.
Kagemusha::DateTime.at(1984, 5, 11, 5, 15, 30) {
  p Date.today.strftime("%Y-%m-%d") #=> 1984-05-11
  p Time.now                        #=> 1984-05-11 05:15:30
  puts "---"
}

p Date.today.strftime("%Y-%m-%d") #=> today
p Time.now                        #=> now
puts "---"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nayutaya-kagemusha-0.0.9 examples/datetime.rb