156件ヒット
[1-100件を表示]
(0.203秒)
別のキーワード
キーワード
- == (12)
-
backtrace
_ locations (12) - byteoffset (6)
-
deconstruct
_ keys (6) - friday? (12)
- mday (12)
- offset (24)
- saturday? (12)
- strftime (12)
- thursday? (12)
- wday (12)
- yday (12)
検索結果
先頭5件
-
Time
# day -> Integer (21338.0) -
日を整数で返します。
...日を整数で返します。
//emlist[][ruby]{
t = Time.local(2000,1,2,3,4,5) # => 2000-01-02 03:04:05 +0900
p t.day # => 2
p t.mday # => 2
//}... -
Time
# saturday? -> bool (18325.0) -
self の表す時刻が土曜日である場合に true を返します。 そうでない場合に false を返します。
...self の表す時刻が土曜日である場合に true を返します。
そうでない場合に false を返します。
//emlist[][ruby]{
t = Time.local(2006, 6, 10) # => 2006-06-10 00:00:00 +0900
p t.saturday? # => true
//}... -
Time
# thursday? -> bool (18325.0) -
self の表す時刻が木曜日である場合に true を返します。 そうでない場合に false を返します。
...self の表す時刻が木曜日である場合に true を返します。
そうでない場合に false を返します。
//emlist[][ruby]{
t = Time.local(1995, 12, 21) # => 1995-12-21 00:00:00 +0900
p t.thursday? # => true
//}... -
Time
# strftime(format) -> String (15781.0) -
時刻を format 文字列に従って文字列に変換した結果を返します。
...時刻を format 文字列に従って文字列に変換した結果を返します。
@param format フォーマット文字列を指定します。使用できるものは 以下の通りです。
* %A: 曜日の名称(Sunday, Monday ... )
* %a: 曜日の省略名(Sun, Mon ... )
* %B: 月......の名称(January, February ... )
* %b: 月の省略名(Jan, Feb ... )
* %C: 世紀 (2009年であれば 20)
* %c: 日付と時刻 (%a %b %e %T %Y)
* %D: 日付 (%m/%d/%y)
* %d: 日(01-31)
* %e: 日。一桁の場合、半角空白で埋める ( 1..31)
* %F: %Y-%m-%d と同等 (ISO 860......0:00:00 UTC からの経過ミリ秒 (Time#strftime は対応していませんが、Date#strftime で使えます)
* %R: 24時間制の時刻。%H:%M と同等。
* %r: 12時間制の時刻。%I:%M:%S %p と同等。
* %S: 秒(00-60) (60はうるう秒)
* %s: 1970-01-01 00:00:00 UTC から... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (15419.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...ption#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Dat......month, -1).day == 31
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_ex......ception'", "test.rb:15:in `<main>'"]
//}
@see Exception#backtrace... -
Time
# friday? -> bool (15225.0) -
self の表す時刻が金曜日である場合に true を返します。 そうでない場合に false を返します。
...self の表す時刻が金曜日である場合に true を返します。
そうでない場合に false を返します。
//emlist[][ruby]{
t = Time.local(1987, 12, 18) # => 1987-12-18 00:00:00 +0900
p t.friday? # => true
//}... -
Time
# deconstruct _ keys(array _ of _ names _ or _ nil) -> Hash (12267.0) -
パターンマッチに使用する名前と値の Hash を返します。
...ar
* :month
* :day
* :yday
* :wday
* :hour
* :min
* :sec
* :subsec
* :dst
* :zone
@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。
//emlist[例][ruby]{
t = Ti......utc(2022, 10, 5, 21, 25, 30)
if 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 "wor......ng 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... -
Date
# deconstruct _ keys(array _ of _ names _ or _ nil) -> Hash (12243.0) -
パターンマッチに使用する名前と値の Hash を返します。
...r
* :month
* :day
* :yday
* :wday
@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。
//emlist[例][ruby]{
d = Date.new(2022, 10, 5)
if d in wday: 3, day: ..7 # deconstruct......使われます
puts "first Wednesday of the month"
end
#=> "first Wednesday of the month" が出力される
case d
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 d in Date(wday: 3, day: ..7)
puts "first Wednesday of the month"
end
//}
@see d:spec/pattern_matching#matching_non_primitive_objects... -
DateTime
# deconstruct _ keys(array _ of _ names _ or _ nil) -> Hash (12237.0) -
パターンマッチに使用する名前と値の Hash を返します。
...r
* :month
* :day
* :yday
* :wday
* :hour
* :min
* :sec
* :sec_fraction
* :zone
@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。
//emlist[例][ruby]{
dt = DateT......dt 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 mont......h 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
# mday -> Integer (9338.0) -
日を整数で返します。
...日を整数で返します。
//emlist[][ruby]{
t = Time.local(2000,1,2,3,4,5) # => 2000-01-02 03:04:05 +0900
p t.day # => 2
p t.mday # => 2
//}... -
Time
# yday -> Integer (9337.0) -
1月1日を1とした通算日(1から366まで)を整数で返します。
...emlist[][ruby]{
p Time.mktime(2000, 1, 1).yday # => 1
//}
うるう年の場合は、2月29日も含めた通算日を返します。
//emlist[うるう年でない場合][ruby]{
p Time.mktime(2003, 1, 1).yday # => 1
p Time.mktime(2003, 3, 1).yday # => 60
p Time.mktime(2003, 12, 31).yday # =......> 365
//}
//emlist[うるう年の場合][ruby]{
p Time.mktime(2004, 1, 1).yday # => 1
p Time.mktime(2004, 2, 29).yday # => 60
p Time.mktime(2004, 12, 31).yday # => 366
//}...