るりまサーチ

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

別のキーワード

  1. prettyprint indent
  2. json indent
  3. json indent=
  4. state indent
  5. state indent=

検索結果

<< < ... 2 3 4 >>

JSON::State#merge(options = {}) -> self (25.0)

与えられたハッシュで自身を設定します。

...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.configure(indent: " ")
json_state.indent # => " "
JSON.generate({key1: "value1", key2...

Refinement#import_methods(*modules) -> self (13.0)

モジュールからメソッドをインポートします。

...いことに注意してください。

//emlist[][ruby]{
module StrUtils
def indent(level)
' ' * level + self
end
end

module M
refine String do
import_methods StrUtils
end
end

using M
p "foo".indent(3) # => " foo"

module M
refine String do
import_methods Enumerable
#...

JSON::State#to_h -> Hash (7.0)

自身をハッシュに変換します。

...身をハッシュに変換します。

//emlist[例][ruby]{
require "json"
require "pp"

json_state = JSON::State.new
pp json_state.to_h

# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,
#...

JSON::State#to_hash -> Hash (7.0)

自身をハッシュに変換します。

...身をハッシュに変換します。

//emlist[例][ruby]{
require "json"
require "pp"

json_state = JSON::State.new
pp json_state.to_h

# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,
#...
<< < ... 2 3 4 >>