るりまサーチ (Ruby 3.1)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.057秒)
トップページ > クエリ:-[x] > クエリ:JSON[x] > クラス:Rational[x] > バージョン:3.1[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method gets
  4. irb/input-method new
  5. matrix -

ライブラリ

キーワード

検索結果

Rational#to_json(*args) -> String (18817.0)

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

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

//emlist[例][ruby]{
require 'json/add/rational'
Rational
(1, 3).to_json # => "{\"json_class\":\"Rational\",\"n\":1,\"d\":3}"
//}

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

Rational.json_create(hash) -> Rational (18655.0)

JSON のオブジェクトから Rational のオブジェクトを生成して返します。

...JSON のオブジェクトから Rational のオブジェクトを生成して返します。

@param hash 分子をキー 'n'、分母をキー 'd' に持つハッシュを指定します。...