るりまサーチ (Ruby 2.3.0)

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

別のキーワード

  1. json state
  2. _builtin state
  3. random state
  4. state indent

クラス

検索結果

JSON::State#indent=(string) (63436.0)

インデントに使用する文字列をセットします。

...ruby]{
require "json"

json
_state = JSON::State.new(indent: "\t")
json
_state.indent # => "\t"
JSON
.generate({key1: "value1", key2: "value2"}, json_state)
# => "{\t\"key1\":\"value1\",\t\"key2\":\"value2\"}"
json
_state.indent = " "
JSON
.generate({key1: "value1", key2: "value2"}, json_state)
# => "{...