Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/dic.rb,
lib/dic.rb,
lib/do_as_rb19.rb

Overview

为Time类加入hm方法,返回格式化后的时和分

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.hmsObject


834
835
836
# File 'lib/dic.rb', line 834

def self.hms
  Time.now.strftime('%H%M%S')
end

.nowObject


922
923
924
# File 'lib/dic.rb', line 922

def now
  _now - $_time
end

.parse(s) ⇒ Object


47
48
49
# File 'lib/do_as_rb19.rb', line 47

def parse s
  Time.parse_(s).localtime
end

Instance Method Details

#_nowObject


921
# File 'lib/dic.rb', line 921

alias _now now

#chObject

ch,小时字符. '㍘' = 0x3358


841
842
843
# File 'lib/dic.rb', line 841

def ch
  " \xE3\x8D".force_encoding('ascii-8bit') + (Time.now.hour + 0x98).chr
end

#hmObject


837
838
839
# File 'lib/dic.rb', line 837

def hm
  Time.now.strftime(' %H:%M')
end

#parse_Object


45
# File 'lib/do_as_rb19.rb', line 45

alias parse_ parse