Sha256: f10fac7811431dd08617db20c26b58796e05b710378a2217b59648257157be09

Contents?: true

Size: 816 Bytes

Versions: 1

Compression:

Stored size: 816 Bytes

Contents

# coding: utf-8
# $Id: datetime.rb 120 2009-02-09 08:22:25Z 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
kagemusha-0.0.8 examples/datetime.rb