57件ヒット
[1-57件を表示]
(0.141秒)
クラス
- DateTime (12)
- Time (34)
- UnboundMethod (11)
キーワード
-
deconstruct
_ keys (2) - rfc2822 (11)
- rfc822 (11)
-
source
_ location (11)
検索結果
先頭5件
-
Time
# zone -> String (24308.0) -
タイムゾーンを表す文字列を返します。
...タイムゾーンを表す文字列を返します。
//emlist[][ruby]{
p Time.now.zone # => "JST"
//}... -
DateTime
# zone -> String (24302.0) -
タイムゾーンを返します。
タイムゾーンを返します。
これは、正確には時差をあらわす文字列です。 -
DateTime
# deconstruct _ keys(array _ of _ names _ or _ nil) -> Hash (12207.0) -
パターンマッチに使用する名前と値の Hash を返します。
...month
* :day
* :yday
* :wday
* :hour
* :min
* :sec
* :sec_fraction
* :zone
@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。
//emlist[例][ruby]{
dt = DateTime.new......t in wday: 1..5, hour: 10..18 # deconstruct_keys が使われます
puts "Working time"
end
#=> "Working time" が出力される
case dt
in year: ...2022
puts "too old"
in month: ..9
puts "quarter 1-3"
in wday: 1..5, month:
puts "working day in month #{month}"
end
#=> "working day in month......10" が出力される
# クラスのチェックと組み合わせて利用することもできます
if dt in DateTime(wday: 1..5, hour: 10..18, day: ..7)
puts "Working time, first week of the month"
end
//}
@see d:spec/pattern_matching#matching_non_primitive_objects... -
Time
# deconstruct _ keys(array _ of _ names _ or _ nil) -> Hash (12207.0) -
パターンマッチに使用する名前と値の Hash を返します。
...名前は以下の通りです。
* :year
* :month
* :day
* :yday
* :wday
* :hour
* :min
* :sec
* :subsec
* :dst
* :zone
@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使......t in wday: 3, day: ..7 # deconstruct_keys が使われます
puts "first Wednesday of the month"
end
#=> "first Wednesday of the month" が出力される
case t
in year: ...2022
puts "too old"
in month: ..9
puts "quarter 1-3"
in wday: 1..5, month:
puts "working day in month #{month}"
end
#......=> "working day in month 10" が出力される
# クラスのチェックと組み合わせて利用することもできます
if t in Time(wday: 3, day: ..7)
puts "first Wednesday of the month"
end
//}
@see d:spec/pattern_matching#matching_non_primitive_objects... -
UnboundMethod
# source _ location -> [String , Integer] | nil (6207.0) -
ソースコードのファイル名と行番号を配列で返します。
... nil を返します。
//emlist[例][ruby]{
require 'time'
Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2.4.0/time.rb", 654]
//}
@see Proc#source_location, Method#source_location... -
Time
# rfc2822 -> String (219.0) -
2822 で定義されている date-time として表現される形式の文字列を 返します。
...れる形式の文字列を
返します。
@return 以下の形式の文字列を返します。
//emlist{
day-of-week, DD month-name CCYY hh:mm:ss zone
//}
ただし zone は [+-]hhmm です。
self が UTC time の場合、zone は +0000 になります。
使用例
require......'time'
iso8601_time = '2008-08-31T12:34:56+09:00'
t = Time.iso8601(iso8601_time)
p t.rfc2822 #=> "Sun, 31 Aug 2008 03:34:56 -0000"... -
Time
# rfc822 -> String (219.0) -
2822 で定義されている date-time として表現される形式の文字列を 返します。
...れる形式の文字列を
返します。
@return 以下の形式の文字列を返します。
//emlist{
day-of-week, DD month-name CCYY hh:mm:ss zone
//}
ただし zone は [+-]hhmm です。
self が UTC time の場合、zone は +0000 になります。
使用例
require......'time'
iso8601_time = '2008-08-31T12:34:56+09:00'
t = Time.iso8601(iso8601_time)
p t.rfc2822 #=> "Sun, 31 Aug 2008 03:34:56 -0000"...