るりまサーチ

最速Rubyリファレンスマニュアル検索!
132件ヒット [1-100件を表示] (0.074秒)
トップページ > クエリ:p[x] > クエリ:nesting[x]

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. kernel p
  5. kernel $-p

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Module.nesting -> [Class, Module] (18113.0)

このメソッドを呼び出した時点でのクラス/モジュールのネスト情 報を配列に入れて返します。

...このメソッドを呼び出した時点でのクラス/モジュールのネスト情
報を配列に入れて返します。

//emlist[例][ruby]{
module Foo
module Bar
module Baz
p
Module.nesting # => [Foo::Bar::Baz, Foo::Bar, Foo]
end
end
end
//}...

JSON::State#depth=(depth) (6232.0)

This sets the maximum level of data structure nesting in the generated JSON to the integer depth, max_nesting = 0 if no maximum should be checked.

...This sets the maximum level of data structure nesting in the generated
JSON to the integer depth, max_nesting = 0 if no maximum should be
checked....

JSON::State#max_nesting=(depth) (6225.0)

生成される JSON 形式の文字列のネストの深さの最大値をセットします。

...せん。

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

json_state = JSON::State.new(max_nesting: 2)
json_state.max_nesting # => 2
JSON.generate([[]], json_state)
json_state.max_nesting = 3
json_state.max_nesting # => 3
JSON.generate([[[[]]]], json_state) # => JSON::NestingError
//}...

JSON::State#depth -> Integer (6116.0)

This integer returns the current depth of data structure nesting.

...This integer returns the current depth of data structure nesting....

JSON.#parse!(source, options = {}) -> object (6106.0)

与えられた JSON 形式の文字列を Ruby オブジェクトに変換して返します。

...換して返します。

JSON.#parse よりも危険なデフォルト値が指定されているので
信頼できる文字列のみを入力として使用するようにしてください。

@param source JSON 形式の文字列を指定します。

@param options オプションをハッシ...
...ュで指定します。
指定可能なオプションは以下の通りです。

: :max_nesting
入れ子になっているデータの最大の深さを指定します。
数値を指定すると深さのチェックを行います。偽を指定すると深さのチェックを行い...
...:\"tanaka\",\"age\":19}, NaN]"
JSON.parse!(json_text)
# => [1, 2, {"name"=>"tanaka", "age"=>19}, NaN]

JSON.parse!(json_text, symbolize_names: true)
# => [1, 2, {:name=>"tanaka", :age=>19}, NaN]

JSON.parse(json_text) # => unexpected token at 'NaN]' (JSON::ParserError)
//}

@see JSON::Parser#parse...

絞り込み条件を変える

JSON.#parse(source, options = {}) -> object (6106.0)

与えられた JSON 形式の文字列を Ruby オブジェクトに変換して返します。

...ジェクトに変換して返します。

@param source JSON 形式の文字列を指定します。

@param options オプションをハッシュで指定します。
指定可能なオプションは以下の通りです。

: :max_nesting
入れ子になっているデータの最大...
...フォルトは偽です。

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

JSON.parse('[1,2,{"name":"tanaka","age":19}]')
# => [1, 2, {"name"=>"tanaka", "age"=>19}]

JSON.parse('[1,2,{"name":"tanaka","age":19}]', symbolize_names: true)
# => [1, 2, {:name=>"tanaka", :age=>19}]
//}

@see JSON::Parser#parse...

変数と定数 (3198.0)

変数と定数 * local * instance * class * class_var_scope * global * pseudo * const * prio

...変数と定数
* local
* instance
* class
* class_var_scope
* global
* pseudo
* const
* prio

Ruby の変数と定数の種別は変数名の最初の一文字によって、
ローカル変数、
インスタンス変数、
クラス変数、
グローバル変数、
定数
のい...
...カル変数は共有されます。

//emlist[][ruby]{
# (A) の部分はスコープに入らない
2.times {
p
defined?(v) # (A)
v = 1 # ここ(宣言開始)から
p
v # ここ(ブロックの終り)までが v のスコープ
}

# => nil
# 1
# nil...
...探索される
p
X # => "C"
end
end
//}

ネストしているクラスの一覧は Class.nesting(あるいはModule.nesting)で取得できます。

//emlist[][ruby]{
module M1
module M2
p
Module.nesting # => [M1::M2, M1]
end
end

module M1::M2
p
Module.nesting # => [M1::M2]
e...

JSON.#unparse(object, state = nil) -> String (3106.0)

与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。

...N::Infinity,
JSON::MinusInfinity を生成することもありません。

unparse は将来削除される予定です。

@param object JSON 形式の文字列に変換するオブジェクトを指定します。

@param state JSON::State または、to_hash や to_h メソッドでハッシュ...
...字列です。
: :space
a string that is put after, a : or , delimiter (default: '')
: :space_before
a string that is put before a : pair delimiter (default: '')
: :object_nl
a string that is put at the end of a JSON object (default: '')
: :array_nl
a string that is put at the end of a JSON...
...
偽を指定した場合、これらの値を生成しようとすると例外が発生します。
デフォルトは偽です。
: :max_nesting
入れ子になっているデータの最大の深さを指定します。
偽を指定すると深さのチェックを行いません。デ...

JSON::Parser.new(source, options => {}) -> JSON::Parser (3106.0)

パーサを初期化します。

...パーサを初期化します。

第二引数のハッシュには以下のキーを指定することができます。

: :max_nesting
データ構造のネストの深さの最大値を指定します。デフォルトは 19 です。
チェックを無効にするにはゼロまたは偽...
...デフォルトは Array です。

@param source パーサの元となる文字列を指定します。

@param options オプションを指定するためのハッシュです。

//emlist[例][ruby]{
require 'json'

p
arser = JSON::Parser.new(DATA.read)
p
rint parser.source

# => {
# => "Tanaka"...
...by]{
require 'json'

class Person
attr_accessor :name, :age

def []=(key, value)
instance_variable_set("@#{key}", value)
end
end

p
arser = JSON::Parser.new(DATA.read, object_class: Person)
p
erson = parser.parse
p
erson.class # => Person
p
erson.name # => "tanaka"
p
erson.age # => 20

__END...
<< 1 2 > >>