40件ヒット
[1-40件を表示]
(0.035秒)
クラス
- DateTime (14)
- Time (14)
- UnboundMethod (12)
キーワード
-
deconstruct
_ keys (4) -
source
_ location (12)
検索結果
先頭5件
-
Time
# zone -> String (24208.0) -
タイムゾーンを表す文字列を返します。
...タイムゾーンを表す文字列を返します。
//emlist[][ruby]{
p Time.now.zone # => "JST"
//}... -
DateTime
# zone -> String (24202.0) -
タイムゾーンを返します。
タイムゾーンを返します。
これは、正確には時差をあらわす文字列です。 -
DateTime
# deconstruct _ keys(array _ of _ names _ or _ nil) -> Hash (6107.0) -
パターンマッチに使用する名前と値の Hash を返します。
...の Hash を返します。
キーに利用できる名前は以下の通りです。
* :year
* :month
* :day
* :yday
* :wday
* :hour
* :min
* :sec
* :sec_fraction
* :zone
@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil......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 (6107.0) -
パターンマッチに使用する名前と値の Hash を返します。
...の Hash を返します。
キーに利用できる名前は以下の通りです。
* :year
* :month
* :day
* :yday
* :wday
* :hour
* :min
* :sec
* :subsec
* :dst
* :zone
@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。n......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 (6107.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...