47件ヒット
[1-47件を表示]
(0.076秒)
ライブラリ
- ビルトイン (7)
- date (4)
-
rubygems
/ specification (36)
クラス
- Date (2)
- DateTime (2)
-
Gem
:: Specification (36) - Range (7)
キーワード
- === (7)
- date= (12)
-
deconstruct
_ keys (4) - validate (12)
検索結果
先頭5件
-
Gem
:: Specification # date -> Time (21102.0) -
日付を返します。
日付を返します。 -
Date
# deconstruct _ keys(array _ of _ names _ or _ nil) -> Hash (17019.0) -
パターンマッチに使用する名前と値の Hash を返します。
...チに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。
//emlist[例][ruby]{
d = Date.new(2022, 10, 5)
if d in wday: 3, day: ..7 # deconstruct_keys が使われます
puts "first Wednesday of the month"
end
#=> "first Wednesday of......g 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 (11007.0) -
パターンマッチに使用する名前と値の Hash を返します。
...チに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。
//emlist[例][ruby]{
dt = DateTime.new(2022, 10, 5, 13, 30)
if dt in wday: 1..5, hour: 10..18 # deconstruct_keys が使われます
puts "Working time"
end
#=> "Working time"......> "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... -
Gem
:: Specification # date=(date) (9219.0) -
@param date 日付をセットします。デフォルトは今日です。
...@param date 日付をセットします。デフォルトは今日です。... -
Gem
:: Specification # validate -> bool (9101.0) -
必須属性のチェックと自身の基本的な正当性チェックを行います。
...ェックと自身の基本的な正当性チェックを行います。
チェックにパスした場合は常に true を返します。そうでない場合は例外が発生します。
@raise Gem::InvalidSpecificationException チェックにパスしなかった場合に発生します。... -
Range
# ===(obj) -> bool (49.0) -
始端と終端の中に obj があるとき、true を返します。 そうでないとき、false を返します。
...りません。
//emlist[例][ruby]{
require 'date'
p (Date.today - 100...Date.today + 100).include?(DateTime.now) #=> false
p (Date.today - 100...Date.today + 100).cover?(DateTime.now) #=> true
p (Date.today - 100...Date.today + 100) === DateTime.now #=> true
# 2.5 以前は、=== は......、include? と同じく比較できず false を返していました。
//}
@see d:spec/control#case
@see Range#include?, Range#cover?......//emlist[例][ruby]{
p ('a'..'z').include? 'at' #=> false
p ('a'..'z').cover? 'at' #=> true
p ('a'..'z') === 'at' #=> true
# 2.6 以前は、=== は、include? と同じく比較できず false を返していました。
//}
@see d:spec/control#case
@see Range#include?, Range#cover?...