るりまサーチ

最速Rubyリファレンスマニュアル検索!
50件ヒット [1-50件を表示] (0.101秒)

別のキーワード

  1. optionparser on
  2. optparse on
  3. tracer on
  4. thread abort_on_exception
  5. thread abort_on_exception=

ライブラリ

キーワード

検索結果

Date#deconstruct_keys(array_of_names_or_nil) -> Hash (6114.0)

パターンマッチに使用する名前と値の Hash を返します。

...* :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...

Date#to_json(*args) -> String (6114.0)

自身を JSON 形式の文字列に変換して返します。

...身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@
param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡され...
...ます。

//emlist[例][ruby]{
require "json/add/core"

Date
.today.to_json
# => "{\"json_class\":\"Date\",\"y\":2018,\"m\":12,\"d\":11,\"sg\":2299161.0}"
//}

@
see JSON::Generator::GeneratorMethods::Hash#to_json...

Date#next_month(n = 1) -> Date (6108.0)

n ヶ月後を返します。

...n ヶ月後を返します。

Date
#>> も参照してください。

@
param n 月数...

Date#prev_month(n = 1) -> Date (6108.0)

n ヶ月前を返します。

...n ヶ月前を返します。

Date
#<< も参照してください。

@
param n 月数...

Date#-(x) -> Rational | Date (114.0)

x が日付オブジェクトなら、ふたつの差を Rational で返します。単位は日です。 あるいは x が数値ならば、self より x 日前の日付を返します。

...日付オブジェクトなら、ふたつの差を Rational で返します。単位は日です。
あるいは
x が数値ならば、self より x 日前の日付を返します。

@
param x 日数、あるいは日付オブジェクト
@
raise TypeError x が数値でも日付オブジェクト...

絞り込み条件を変える