Sha256: 50818d4748ceb4fc03eb2751ef442eb7cccea8943f8e403e5e33a7811e1047d0

Contents?: true

Size: 761 Bytes

Versions: 1

Compression:

Stored size: 761 Bytes

Contents

# coding: utf-8

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.1.0 examples/datetime.rb