クラス
- CSV (1)
- Encoding (4)
-
Encoding
:: Converter (1) -
Enumerator
:: Lazy (5) -
Gem
:: StreamUI (4) - IO (1)
-
JSON
:: State (31) -
OpenSSL
:: SSL :: SSLSocket (1) -
Rake
:: Application (1) - Random (2)
- Thread (4)
モジュール
- GC (2)
- JSON (5)
-
JSON
:: Generator :: GeneratorMethods :: Array (1) -
JSON
:: Generator :: GeneratorMethods :: FalseClass (1) -
JSON
:: Generator :: GeneratorMethods :: Float (1) -
JSON
:: Generator :: GeneratorMethods :: Hash (1) -
JSON
:: Generator :: GeneratorMethods :: Integer (1) -
JSON
:: Generator :: GeneratorMethods :: NilClass (1) -
JSON
:: Generator :: GeneratorMethods :: Object (1) -
JSON
:: Generator :: GeneratorMethods :: String (1) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (1) - Observable (1)
キーワード
-
NEWS for Ruby 2
. 2 . 0 (1) -
STATELESS
_ ISO _ 2022 _ JP (1) -
STATELESS
_ ISO _ 2022 _ JP _ KDDI (1) - State (2)
-
Stateless
_ ISO _ 2022 _ JP (1) -
Stateless
_ ISO _ 2022 _ JP _ KDDI (1) - [] (1)
- []= (1)
-
abort
_ on _ exception= (2) - alert (1)
-
alert
_ error (1) -
alert
_ warning (1) -
allow
_ nan? (1) -
array
_ nl (1) -
array
_ nl= (1) -
ascii
_ only? (1) -
buffer
_ initial _ length (1) -
buffer
_ initial _ length= (1) - changed (1)
-
check
_ circular? (1) - chunk (2)
- configure (1)
- depth (1)
- depth= (1)
-
from
_ state (1) - generate (2)
- indent (1)
- indent= (1)
-
insert
_ output (1) -
jump
_ tag _ but _ local _ jump (1) -
latest
_ gc _ info (2) -
max
_ nesting (1) -
max
_ nesting= (1) - merge (1)
- new (1)
-
object
_ nl (1) -
object
_ nl= (1) -
pretty
_ generate (1) -
pretty
_ unparse (1) -
quirks
_ mode (1) -
quirks
_ mode= (1) -
quirks
_ mode? (1) -
rb
_ eval _ string _ protect (1) -
rb
_ eval _ string _ wrap (1) -
rb
_ jump _ tag (1) -
rb
_ load _ protect (1) -
rb
_ protect (1) -
rb
_ reserved _ word (1) -
report
_ on _ exception= (2) - say (1)
-
slice
_ before (3) - space (1)
- space= (1)
-
space
_ before (1) -
space
_ before= (1) - sync= (2)
-
to
_ h (1) -
to
_ hash (1) -
to
_ json (9) -
tty
_ output= (1) - unparse (1)
検索結果
先頭5件
-
JSON
. state -> JSON :: Ext :: Generator :: State (54643.0) -
JSON ライブラリがジェネレータの状態を表すクラスとして使用するクラスを返します。
JSON ライブラリがジェネレータの状態を表すクラスとして使用するクラスを返します。
//emlist[例][ruby]{
require "json"
JSON.state # => JSON::Ext::Generator::State
//} -
OpenSSL
:: SSL :: SSLSocket # state -> String (54304.0) -
現在の状態をアルファベット 6 文字の文字列で返します。
現在の状態をアルファベット 6 文字の文字列で返します。 -
Random
# state -> Integer (54304.0) -
C言語レベルで定義されている構造体MTの状態を参照します。詳しくはrandom.c を参照してください。
C言語レベルで定義されている構造体MTの状態を参照します。詳しくはrandom.c を参照してください。 -
Random
. state -> Integer (54304.0) -
C言語レベルで定義されている構造体MTの静的変数default_randの状態を参照します。詳しくはrandom.c を参照してください。
C言語レベルで定義されている構造体MTの静的変数default_randの状態を参照します。詳しくはrandom.c を参照してください。 -
JSON
:: State . from _ state(options) -> JSON :: State (27979.0) -
与えられた options によって生成した JSON::State のインスタンスを返します。
与えられた options によって生成した JSON::State のインスタンスを返します。
@param options JSON::State のインスタンスか、ハッシュを指定します。
@return options がハッシュである場合は、それによって初期化した JSON::State を
返します。options が JSON::State のインスタンスである場合は単に
options を返します。いずれでも無い場合は、何も設定されていない JSON::State の
インスタンスを返します。
//emlist[例 Hash... -
Encoding
:: STATELESS _ ISO _ 2022 _ JP -> Encoding (18301.0) -
stateless-ISO-2022-JP エンコーディングです。
stateless-ISO-2022-JP エンコーディングです。
ISO-2022-JPをステートレスに扱うための方式です。
Emacs-Mule エンコーディングを元にしています。 -
Encoding
:: STATELESS _ ISO _ 2022 _ JP _ KDDI -> Encoding (18301.0) -
stateless-ISO-2022-JP-KDDI エンコーディングです。
stateless-ISO-2022-JP-KDDI エンコーディングです。
stateless-ISO-2022-JP の亜種です。
KDDI の携帯電話で使われる絵文字が含まれています。
@see https://www.au.com/ezfactory/tec/spec/img/typeD.pdf -
Encoding
:: Stateless _ ISO _ 2022 _ JP -> Encoding (18301.0) -
stateless-ISO-2022-JP エンコーディングです。
stateless-ISO-2022-JP エンコーディングです。
ISO-2022-JPをステートレスに扱うための方式です。
Emacs-Mule エンコーディングを元にしています。 -
Encoding
:: Stateless _ ISO _ 2022 _ JP _ KDDI -> Encoding (18301.0) -
stateless-ISO-2022-JP-KDDI エンコーディングです。
stateless-ISO-2022-JP-KDDI エンコーディングです。
stateless-ISO-2022-JP の亜種です。
KDDI の携帯電話で使われる絵文字が含まれています。
@see https://www.au.com/ezfactory/tec/spec/img/typeD.pdf -
JSON
:: Ext :: Generator :: State (18049.0) -
Alias of JSON::State
Alias of JSON::State -
JSON
:: State (18001.0) -
Ruby オブジェクトから JSON 形式の文字列を生成する間、 JSON 形式の文字列を生成するための設定を保持しておくために使用するクラスです。
Ruby オブジェクトから JSON 形式の文字列を生成する間、
JSON 形式の文字列を生成するための設定を保持しておくために使用するクラスです。 -
JSON
:: State . new(options = {}) -> JSON :: State (9502.0) -
自身を初期化します。
自身を初期化します。
@param options ハッシュを指定します。
指定可能なオプションは以下の通りです。
: :indent
インデントに使用する文字列を指定します。デフォルトは空文字列です。
: :space
JSON 形式の文字列のトークン間に挿入する文字列を指定します。デフォルトは空文字列です。
: :space_before
JSON 形式の文字列中で JavaScript のオブジェクトを表す部分にある ':' の
前に挿入する文字列をセットします。デフォルトは空文字列です。
: :object_nl
JSON 形式の文字列中に現れる... -
JSON
:: State # configure(options = {}) -> self (9163.0) -
与えられたハッシュで自身を設定します。
与えられたハッシュで自身を設定します。
オプションで使用するハッシュのキーについては JSON::State.new を参照してください。
@param options このオブジェクトの設定をするためのハッシュを指定します。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new(indent: "\t")
json_state.indent # => "\t"
JSON.generate({key1: "value1", key2: "value2"}, json_state)
# => "{\t\"key1\... -
JSON
:: State # max _ nesting -> Integer (9163.0) -
生成される JSON 形式の文字列のネストの深さの最大値を返します。
生成される JSON 形式の文字列のネストの深さの最大値を返します。
この値がゼロである場合は、ネストの深さのチェックを行いません。
//emlist[例 ネストの深さチェックを行う][ruby]{
require "json"
json_state = JSON::State.new(max_nesting: 2)
json_state.max_nesting # => 2
JSON.generate([[]], json_state)
JSON.generate([[[]]], json_state) # => JSON::NestingError
//}
... -
JSON
:: State # merge(options = {}) -> self (9163.0) -
与えられたハッシュで自身を設定します。
与えられたハッシュで自身を設定します。
オプションで使用するハッシュのキーについては JSON::State.new を参照してください。
@param options このオブジェクトの設定をするためのハッシュを指定します。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new(indent: "\t")
json_state.indent # => "\t"
JSON.generate({key1: "value1", key2: "value2"}, json_state)
# => "{\t\"key1\... -
JSON
:: State # object _ nl -> String (9145.0) -
JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列を返します。
JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列を返します。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new(object_nl: "")
json_state.object_nl # => ""
puts JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => [1,2,{"name":"tanaka","age":19}]
json_state = JSON:... -
JSON
:: State # space -> String (9145.0) -
JSON 形式の文字列のトークン間に挿入する文字列を返します。
JSON 形式の文字列のトークン間に挿入する文字列を返します。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new(space: "")
json_state.space # => ""
puts JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => [1,2,{"name":"tanaka","age":19}]
json_state = JSON::State.new(space: "\t")
json_... -
JSON
:: State # space _ before -> String (9145.0) -
JSON 形式の文字列中で JavaScript のオブジェクトを表す部分にある ':' の 前に挿入する文字列を返します。
JSON 形式の文字列中で JavaScript のオブジェクトを表す部分にある ':' の
前に挿入する文字列を返します。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new(space_before: "")
json_state.space_before # => ""
puts JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => [1,2,{"name":"tanaka","age":19}]
js... -
JSON
:: State # max _ nesting=(depth) (9127.0) -
生成される JSON 形式の文字列のネストの深さの最大値をセットします。
生成される 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.g... -
JSON
:: State # object _ nl=(string) (9127.0) -
JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列をセットします。
JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列をセットします。
@param string JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列を指定します。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new(object_nl: "")
json_state.object_nl # => ""
puts JSON.generate([1, 2, { name: "tanaka", age: 19 }]... -
JSON
:: State # space=(string) (9127.0) -
JSON 形式の文字列のトークン間に挿入する文字列をセットします。
JSON 形式の文字列のトークン間に挿入する文字列をセットします。
@param string JSON 形式の文字列のトークン間に挿入する文字列を指定します。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new(space: "")
json_state.space # => ""
puts JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => [1,2,{"name":"tanaka","age":19}... -
JSON
:: State # space _ before=(string) (9127.0) -
JSON 形式の文字列中で JavaScript のオブジェクトを表す部分にある ':' の 前に挿入する文字列をセットします。
JSON 形式の文字列中で JavaScript のオブジェクトを表す部分にある ':' の
前に挿入する文字列をセットします。
@param string JSON 形式の文字列中で JavaScript のオブジェクトを表す部分にある ':' の
前に挿入する文字列をセットします。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new(space_before: "")
json_state.space_before # => ""
puts JSON.gen... -
JSON
:: State # allow _ nan? -> bool (9109.0) -
NaN, Infinity, -Infinity を生成できる場合、真を返します。 そうでない場合は偽を返します。
NaN, Infinity, -Infinity を生成できる場合、真を返します。
そうでない場合は偽を返します。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new({})
json_state.allow_nan? # => false
json_state = JSON::State.new(allow_nan: true)
json_state.allow_nan? # => true
//}
@see 4627 -
JSON
:: State # array _ nl -> String (9109.0) -
JSON の配列の後に出力する文字列を返します。
JSON の配列の後に出力する文字列を返します。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new({})
json_state.array_nl # => ""
json_state = JSON::State.new(array_nl: "\n")
json_state.array_nl # => "\n"
//} -
JSON
:: State # indent=(string) (9109.0) -
インデントに使用する文字列をセットします。
インデントに使用する文字列をセットします。
@param string インデントに使用する文字列を指定します。
//emlist[例][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
:: State # array _ nl=(str) (9091.0) -
JSON の配列の後に出力する文字列をセットします。
JSON の配列の後に出力する文字列をセットします。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new({})
json_state.array_nl # => ""
json_state.array_nl = "\n"
json_state.array_nl # => "\n"
//} -
JSON
:: State # indent -> String (9073.0) -
インデントに使用する文字列を返します。
インデントに使用する文字列を返します。
//emlist[例][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 # to _ h -> Hash (9055.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,
# :max_nesting=>100,
# ... -
JSON
:: State # to _ hash -> Hash (9055.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,
# :max_nesting=>100,
# ... -
JSON
:: State # check _ circular? -> bool (9037.0) -
循環参照のチェックを行う場合は、真を返します。 そうでない場合は偽を返します。
循環参照のチェックを行う場合は、真を返します。
そうでない場合は偽を返します。
//emlist[例 ネストをチェックするケース][ruby]{
require "json"
a = [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]... -
JSON
:: State # [](name) -> object (9001.0) -
Return the value returned by method name.
Return the value returned by method name. -
JSON
:: State # []=(name , value) (9001.0) -
Set the attribute name to value.
Set the attribute name to value. -
JSON
:: State # ascii _ only? -> bool (9001.0) -
ASCII 文字列のみを用いて JSON 形式の文字列を生成する場合に真を返します。 そうでない場合に偽を返します。
ASCII 文字列のみを用いて JSON 形式の文字列を生成する場合に真を返します。
そうでない場合に偽を返します。 -
JSON
:: State # buffer _ initial _ length -> Integer (9001.0) -
This integer returns the current initial length of the buffer.
This integer returns the current initial length of the buffer. -
JSON
:: State # buffer _ initial _ length=(length) (9001.0) -
This sets the initial length of the buffer to length, if length > 0, otherwise its value isn't changed.
This sets the initial length of the buffer to length, if length > 0,
otherwise its value isn't changed. -
JSON
:: State # depth -> Integer (9001.0) -
This integer returns the current depth of data structure nesting.
This integer returns the current depth of data structure nesting. -
JSON
:: State # depth=(depth) (9001.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 # generate(obj) -> String (9001.0) -
Generates a valid JSON document from object obj and returns the result. If no valid JSON document can be created this method raises a GeneratorError exception.
Generates a valid JSON document from object obj and returns the
result. If no valid JSON document can be created this method raises a
GeneratorError exception. -
JSON
:: State # quirks _ mode -> bool (9001.0) -
Returns true, if quirks mode is enabled. Otherwise returns false.
Returns true, if quirks mode is enabled. Otherwise returns false. -
JSON
:: State # quirks _ mode=(enable) (9001.0) -
If set to true, enables the quirks_mode mode.
If set to true, enables the quirks_mode mode. -
JSON
:: State # quirks _ mode? -> bool (9001.0) -
Returns true, if quirks mode is enabled. Otherwise returns false.
Returns true, if quirks mode is enabled. Otherwise returns false. -
Enumerator
:: Lazy # chunk(initial _ state) {|elt , state| . . . } -> Enumerator :: Lazy (607.0) -
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>
1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [1, 2]], [true, [3]], [false, [4, 5... -
Enumerator
:: Lazy # slice _ before(initial _ state) {|elt , state| bool } -> Enumerator :: Lazy (607.0) -
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>
1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
JSON
. # generate(object , state = nil) -> String (415.0) -
与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。
与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。
デフォルトでは、サイズが最小となる JSON 形式の文字列を生成します。
また、循環参照のチェックを行います。JSON::NaN, JSON::Infinity,
JSON::MinusInfinity を生成することもありません。
unparse は将来削除される予定です。
@param object JSON 形式の文字列に変換するオブジェクトを指定します。
@param state JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できます。
... -
JSON
. # unparse(object , state = nil) -> String (415.0) -
与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。
与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。
デフォルトでは、サイズが最小となる JSON 形式の文字列を生成します。
また、循環参照のチェックを行います。JSON::NaN, JSON::Infinity,
JSON::MinusInfinity を生成することもありません。
unparse は将来削除される予定です。
@param object JSON 形式の文字列に変換するオブジェクトを指定します。
@param state JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できます。
... -
JSON
:: Generator :: GeneratorMethods :: Array # to _ json(state _ or _ hash = nil) -> String (358.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
[1, 2, 3].to_json # => "[1,2,3]"
//} -
JSON
:: Generator :: GeneratorMethods :: FalseClass # to _ json(state _ or _ hash = nil) -> String (358.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
"false" という文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
false.to_json # => "false"
//} -
JSON
:: Generator :: GeneratorMethods :: Float # to _ json(state _ or _ hash = nil) -> String (358.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
(1.0).to_json # => "1.0"
//} -
JSON
:: Generator :: GeneratorMethods :: Hash # to _ json(state _ or _ hash = nil) -> String (358.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
person = { "name" => "tanaka", "age" => 19 }
person.to_json # ... -
JSON
:: Generator :: GeneratorMethods :: Integer # to _ json(state _ or _ hash = nil) -> String (358.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
10.to_json # => "10"
//} -
JSON
:: Generator :: GeneratorMethods :: NilClass # to _ json(state _ or _ hash = nil) -> String (358.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
"null" という文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
nil.to_json # => "null"
//} -
JSON
:: Generator :: GeneratorMethods :: Object # to _ json(state _ or _ hash = nil) -> String (358.0) -
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
このメソッドはあるオブジェクトに to_json メソッドが定義されていない場合に使用する
フォールバックのためのメソッドです。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby... -
JSON
:: Generator :: GeneratorMethods :: String # to _ json(state _ or _ hash = nil) -> String (358.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
自身のエンコードは UTF-8 であるべきです。
"\u????" のように UTF-16 ビッグエンディアンでエンコードされた文字列を返すことがあります。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]... -
JSON
:: Generator :: GeneratorMethods :: TrueClass # to _ json(state _ or _ hash = nil) -> String (358.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
"true" という文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
true.to_json # => "true"
//} -
Observable
# changed(state = true) -> bool (322.0) -
更新フラグを立てます。
更新フラグを立てます。
更新フラグを指定された内容へ変更し、変更後の更新フラグの状態を返します。
明示的に引数を指定して、更新フラグを初期化することも出来ます。
@param state 更新フラグを立てる場合はtrueを、初期化する場合はfalseを指定します。 -
Rake
:: Application # tty _ output=(tty _ output _ state) (322.0) -
TTY に対する出力状態を上書きします。
TTY に対する出力状態を上書きします。
大抵の場合、テストのために使用します。
@param tty_output_state 変更後の状態を指定します
//emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do
Rake.application.tty_output? # => false
Rake.application.tty_output = "debug output" # => "debug output"
... -
VALUE rb
_ eval _ string _ protect(const char *str , int *state) (319.0) -
str を Ruby プログラムとしてコンパイル・評価し、 その値を返します。
str を Ruby プログラムとしてコンパイル・評価し、
その値を返します。
コンパイル中または評価中に例外を含む大域脱出が発生した場合は、
state が NULL でなければそれに値が代入され Qnil を返します。 -
CSV
# sync=(newstate) (301.0) -
IO#sync= に委譲します。
IO#sync= に委譲します。
@see IO#sync= -
Gem
:: StreamUI # alert(statement , question = nil) -> String | nil (301.0) -
INFO レベルのアラートを表示します。
INFO レベルのアラートを表示します。
@param statement 表示する文字列を指定します。
@param question 必要であれば質問を指定します。
@return question を指定した場合は、それに対する回答を返します。
question を指定しない場合は nil を返します。
@see Gem::StreamUI#ask -
Gem
:: StreamUI # alert _ error(statement , question = nil) -> String | nil (301.0) -
ERROR レベルのアラートを表示します。
ERROR レベルのアラートを表示します。
@param statement 表示する文字列を指定します。
@param question 必要であれば質問を指定します。
@return question を指定した場合は、それに対する回答を返します。
question を指定しない場合は nil を返します。
@see Gem::StreamUI#ask -
Gem
:: StreamUI # alert _ warning(statement , question = nil) -> String | nil (301.0) -
WARNING レベルのアラートを表示します。
WARNING レベルのアラートを表示します。
@param statement 表示する文字列を指定します。
@param question 必要であれば質問を指定します。
@return question を指定した場合は、それに対する回答を返します。
question を指定しない場合は nil を返します。
@see Gem::StreamUI#ask -
Gem
:: StreamUI # say(statement = & # 39;& # 39;) -> () (301.0) -
与えられた文字列を表示します。
与えられた文字列を表示します。
@param statement 表示する文字列を指定します。 -
IO
# sync=(newstate) (301.0) -
自身を同期モードに設定すると、出力関数の呼出毎にバッファがフラッシュされます。
自身を同期モードに設定すると、出力関数の呼出毎にバッファがフラッシュされます。
@param newstate 自身を同期モードに設定するかを boolean で指定します。
@raise IOError 既に close されていた場合に発生します。
@see IO#sync -
Thread
# abort _ on _ exception=(newstate) (301.0) -
真の場合、そのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例 外は、Thread#join などで検出されない限りそのスレッ ドだけをなにも警告を出さずに終了させます。
真の場合、そのスレッドが例外によって終了した時に、インタプリタ
全体を中断させます。false の場合、あるスレッドで起こった例
外は、Thread#join などで検出されない限りそのスレッ
ドだけをなにも警告を出さずに終了させます。
デフォルトは偽です。c:Thread#exceptionを参照してください。
@param newstate 自身を実行中に例外発生した場合、インタプリタ全体を終了させるかどうかを true か false で指定します。
//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.abort_o... -
Thread
# report _ on _ exception=(newstate) (301.0) -
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
デフォルトはスレッド作成時の Thread.report_on_exception です。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを true か false で指定します。
//emlist[例][ruby]{
a = Thread.new{ Thread.stop; raise }
a.report_on_exception = true
a.report_on_exception # => true
a.run
# => #<Th... -
Thread
. abort _ on _ exception=(newstate) (301.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例外は、Thread#join などで検出されない限りそのスレッドだけをなにも警告を出さずに終了させます。
真の時は、いずれかのスレッドが例外によって終了した時に、インタプリタ
全体を中断させます。false の場合、あるスレッドで起こった例外は、Thread#join
などで検出されない限りそのスレッドだけをなにも警告を出さずに終了させます。
デフォルトは false です。
c:Thread#exceptionを参照してください。
@param newstate スレッド実行中に例外発生した場合、インタプリタ全体を終了させるかどうかを true か false で指定します。
//emlist[例][ruby]{
Thread.abort_on_exception # => false... -
Thread
. report _ on _ exception=(newstate) (301.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
デフォルトは false です。
Thread.new { 1.times { raise } }
は $stderr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: fr... -
VALUE rb
_ eval _ string _ wrap(const char *str , int *state) (301.0) -
rb_eval_string_protect と同じですが,スクリプトの評価を 無名のモジュールのもとで行います。
rb_eval_string_protect と同じですが,スクリプトの評価を
無名のモジュールのもとで行います。 -
VALUE rb
_ protect(VALUE (*proc)() , VALUE data , int *state) (301.0) -
初出: 4064
初出: 4064
proc(data) を評価中のあらゆる大域脱出(例外を含む)を捕捉します。
val = rb_protect(func, arg, &status);
if (status != 0) {
puts("大域脱出が起きた");
rb_jump_tag(status);
} -
static void jump
_ tag _ but _ local _ jump(int state) (301.0) -
-
void rb
_ load _ protect(VALUE fname , int wrap , int *state) (301.0) -
-
static struct kwtable * rb
_ reserved _ word(const char *str , unsigned int len) (55.0) -
長さ len の文字列 str が予約語であれば そのフラグテーブルを返します。str が予約語でなければ NULL を返します。
長さ len の文字列 str が予約語であれば
そのフラグテーブルを返します。str が予約語でなければ
NULL を返します。
struct kwtable {
char *name; /* 予約語の名前 */
int id[2]; /* 0: 非修飾型シンボル
1: 修飾型シンボル (kIF_MOD など) があれば
それを格納する。なければ id[0]... -
Encoding
:: Converter # insert _ output(string) -> nil (19.0) -
変換器内のバッファに文字列を挿入します。 バッファに保持された文字列は、次の変換時の変換結果と一緒に返されます。
変換器内のバッファに文字列を挿入します。
バッファに保持された文字列は、次の変換時の変換結果と一緒に返されます。
変換先がステートフルなエンコーディングであった場合、
挿入された文字列は状態に基づいて変換され、状態を更新します。
このメソッドは変換に際してエラーが発生した際にのみ利用されるべきです。
@param string 挿入する文字列
//emlist[][ruby]{
ec = Encoding::Converter.new("utf-8", "iso-8859-1")
src = "HIRAGANA LETTER A is \u{3042}."
dst = ""
p ec.... -
GC
. latest _ gc _ info(key) -> object (19.0) -
最新のGCの情報を返します。
最新のGCの情報を返します。
@param result_hash 戻り値のためのハッシュを指定します。省略した場合は新
しくハッシュを作成します。result_hash の内容は上書き
されます。
@param key 得られる情報から特定の情報を取得したい場合にキーを
Symbol で指定します。
//emlist[例][ruby]{
latest = GC.latest_gc_info
latest # => {:major_by=>nil, :gc_by=>:newobj, :ha... -
GC
. latest _ gc _ info(result _ hash = {}) -> Hash (19.0) -
最新のGCの情報を返します。
最新のGCの情報を返します。
@param result_hash 戻り値のためのハッシュを指定します。省略した場合は新
しくハッシュを作成します。result_hash の内容は上書き
されます。
@param key 得られる情報から特定の情報を取得したい場合にキーを
Symbol で指定します。
//emlist[例][ruby]{
latest = GC.latest_gc_info
latest # => {:major_by=>nil, :gc_by=>:newobj, :ha... -
JSON
. # pretty _ generate(object , options = nil) -> String (19.0) -
Ruby のオブジェクトを JSON 形式の文字列に変換して返します。
Ruby のオブジェクトを JSON 形式の文字列に変換して返します。
このメソッドは JSON.#generate よりも人間に読みやすい文字列を返します。
pretty_unparse は将来削除される予定です。
@param object JSON 形式の文字列に変換するオブジェクトを指定します。
@param options JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できます。
ハッシュを使用する場合指定可能なオプションは JSON.#generate を参照してください。
//emlist[... -
JSON
. # pretty _ unparse(object , options = nil) -> String (19.0) -
Ruby のオブジェクトを JSON 形式の文字列に変換して返します。
Ruby のオブジェクトを JSON 形式の文字列に変換して返します。
このメソッドは JSON.#generate よりも人間に読みやすい文字列を返します。
pretty_unparse は将来削除される予定です。
@param object JSON 形式の文字列に変換するオブジェクトを指定します。
@param options JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できます。
ハッシュを使用する場合指定可能なオプションは JSON.#generate を参照してください。
//emlist[... -
NEWS for Ruby 2
. 2 . 0 (19.0) -
NEWS for Ruby 2.2.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
NEWS for Ruby 2.2.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 2.1.0 以降の変更
=== 言語仕様の変更
* nil/true/false
* nil/true/false はフリーズされました 8923
* Hash リテラル
* 後ろにコロンのあるシンボルをキーにしたと... -
void rb
_ jump _ tag(int tag) (19.0) -
初出: 4064
初出: 4064
rb_load_protect,rb_eval_string_protect,rb_protect
などで捕捉した大域脱出を再生成します。
tagには上記関数の引数で受け取ったstateを指定します。 -
Enumerator
:: Lazy # chunk {|elt| . . . } -> Enumerator :: Lazy (7.0) -
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>
1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [1, 2]], [true, [3]], [false, [4, 5... -
Enumerator
:: Lazy # slice _ before {|elt| bool } -> Enumerator :: Lazy (7.0) -
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>
1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
Enumerator
:: Lazy # slice _ before(pattern) -> Enumerator :: Lazy (7.0) -
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>
1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6...