種類
- インスタンスメソッド (57)
- 定数 (22)
- 特異メソッド (20)
- クラス (1)
クラス
- Object (2)
-
Psych
:: Emitter (4) -
Psych
:: Handler (9) -
Psych
:: Nodes :: Alias (2) -
Psych
:: Nodes :: Document (3) -
Psych
:: Nodes :: Mapping (7) -
Psych
:: Nodes :: Node (4) -
Psych
:: Nodes :: Scalar (12) -
Psych
:: Nodes :: Sequence (7) -
Psych
:: Nodes :: Stream (6) -
Psych
:: Parser (4) -
Psych
:: Parser :: Mark (3) -
Psych
:: ScalarScanner (2) -
Psych
:: Stream (4) -
Psych
:: SyntaxError (6) -
Psych
:: TreeBuilder (2) -
Psych
:: Visitors :: YAMLTree (8)
キーワード
- ANY (5)
- BLOCK (2)
-
DOUBLE
_ QUOTED (1) - FLOW (2)
- FOLDED (1)
-
LIBYAML
_ VERSION (1) - LITERAL (1)
- PLAIN (1)
-
SINGLE
_ QUOTED (1) - UTF16BE (2)
- UTF16LE (2)
- UTF8 (2)
- VERSION (1)
- YAMLTree (1)
- alias (1)
- anchor (4)
- canonical (1)
- children (1)
- column (2)
- context (1)
- dump (1)
-
dump
_ stream (1) - encoding (1)
-
end
_ document (1) -
end
_ mapping (1) - file (1)
- finish (2)
- finished (1)
- finished? (1)
- indentation (1)
- index (1)
-
libyaml
_ version (1) - line (2)
-
line
_ width (1) -
load
_ stream (2) - new (10)
- offset (1)
- parse (1)
-
parse
_ file (1) -
parse
_ time (1) - plain (1)
- problem (1)
-
psych
_ to _ yaml (1) -
psych
_ y (1) - root (1)
-
safe
_ load (2) - scalar (1)
- start (3)
-
start
_ document (1) -
start
_ mapping (1) -
start
_ sequence (1) -
start
_ stream (1) - started (1)
- started? (1)
- streaming? (1)
- style (3)
- tag (4)
-
tag
_ directives (1) -
to
_ json (1) -
to
_ yaml (2) - tokenize (1)
- tree (1)
- value (1)
- version (1)
- y (1)
- yaml (1)
検索結果
先頭5件
-
Psych
:: ScalarScanner # parse _ time(string) -> Time (46207.0) -
文字列を Time オブジェクトに変換します。
文字列を Time オブジェクトに変換します。
@param string 変換文字列 -
Psych
. parse _ file(filename) -> Psych :: Nodes :: Document (37207.0) -
filename で指定したファイルをパースして YAML の AST を返します。
...filename で指定したファイルをパースして YAML の AST を返します。
@param filename パースするファイルの名前
@raise Psych::SyntaxError YAMLドキュメントに文法エラーが発見されたときに発生します... -
Psych
. libyaml _ version -> [Integer , Integer , Integer] (36925.0) -
libyaml のバージョンを返します。
...libyaml のバージョンを返します。
[major, minor patch-level] という 3 つの整数からなる配列を返します。
@see Psych::LIBYAML_VERSION... -
Psych
:: Handler # start _ mapping(anchor , tag , implicit , style) -> () (36907.0) -
mapping の開始を見付けたときに呼び出されます。
...偽値で渡されます。
style には sequence の style が整数値で渡されます。以下のいずれか
です。
* Psych::Nodes::Mapping::BLOCK
* Psych::Nodes::Mapping::FLOW
必要に応じてこのメソッドを override してください。
@param anchor 関連付けられた... -
Psych
:: Handler # streaming? -> bool (36907.0) -
handler が streaming handler であるならば真を返すように override してください。
handler が streaming handler であるならば真を返すように
override してください。
デフォルトでは false を返します。 -
Psych
:: LIBYAML _ VERSION -> String (36907.0) -
libyaml のバージョン。
libyaml のバージョン。 -
Psych
:: Nodes :: Document # tag _ directives -> [[String , String]] (36907.0) -
tag directive の配列を返します。
...tag directive の配列を返します。
@see Psych::Nodes::Document#tag_directives=,
Psych::Nodes::Document.new... -
Psych
:: Nodes :: Document # version -> [Integer] (36907.0) -
YAML ドキュメントのバージョンを返します。
...YAML ドキュメントのバージョンを返します。
@see Psych::Nodes::Document#version=,
Psych::Nodes::Document.new... -
Psych
:: Nodes :: Node # children -> [Psych :: Nodes :: Node] (36907.0) -
子ノードの集合を配列で返します。
子ノードの集合を配列で返します。 -
Psych
:: Nodes :: Scalar :: LITERAL -> Integer (36907.0) -
literal style を表します。
...literal style を表します。
@see Psych::Nodes::Scalar.new,
Psych::Nodes::Scalar#style,
Psych::Handler#scalar... -
Psych
:: VERSION -> String (36907.0) -
Psych のバージョン。
...Psych のバージョン。... -
Psych
:: Visitors :: YAMLTree # finish -> Psych :: Nodes :: Stream|nil (36907.0) -
変換を終了し、構築した AST を返します。
...変換を終了し、構築した AST を返します。
このメソッドは2回呼び出さないでください。
@see Psych::Visitors::YAMLTree#tree... -
Psych
:: Visitors :: YAMLTree # finished -> bool (36607.0) -
Psych::Visitors::YAMLTree#finish をすでに呼び出しているならば 真を返します。
...Psych::Visitors::YAMLTree#finish をすでに呼び出しているならば
真を返します。
まだならば偽を返します。... -
Psych
:: Visitors :: YAMLTree # finished? -> bool (36607.0) -
Psych::Visitors::YAMLTree#finish をすでに呼び出しているならば 真を返します。
...Psych::Visitors::YAMLTree#finish をすでに呼び出しているならば
真を返します。
まだならば偽を返します。... -
Psych
:: Emitter # indentation -> Integer (28207.0) -
インデントのレベルを返します。
...インデントのレベルを返します。
@see Psych::Emitter#indentation=... -
Psych
:: Emitter # line _ width -> Integer (28207.0) -
「好ましい」行幅を返します。
...「好ましい」行幅を返します。
@see Psych::Emitter#line_width=... -
Psych
:: Nodes :: Scalar :: PLAIN -> Integer (28207.0) -
plain scalar style を表します。
...plain scalar style を表します。
@see Psych::Nodes::Scalar.new,
Psych::Nodes::Scalar#style,
Psych::Handler#scalar... -
Psych
:: Nodes :: Scalar :: SINGLE _ QUOTED -> Integer (28207.0) -
single quoted style を表します。
...single quoted style を表します。
@see Psych::Nodes::Scalar.new,
Psych::Nodes::Scalar#style,
Psych::Handler#scalar... -
Psych
:: Nodes :: Stream # encoding -> Integer (28207.0) -
stream に使われるエンコーディングを返します。
...stream に使われるエンコーディングを返します。
@see Psych::Nodes::Stream#encoding=... -
Psych
:: Parser :: Mark # index -> Integer (28207.0) -
先頭からの文字数。
先頭からの文字数。 -
Psych
:: Parser :: Mark # line -> Integer (28207.0) -
先頭からの行数。
先頭からの行数。 -
Psych
:: SyntaxError # file -> String|nil (28207.0) -
エラーが生じたファイルの名前を返します。
...エラーが生じたファイルの名前を返します。
Psych.load_file で指定したファイルの名前や
Psych.load の第2引数で指定した名前が返されます。
パース時にファイル名を指定しなかった場合は nil が返されます。... -
Psych
:: SyntaxError # line -> Integer (28207.0) -
エラーが生じた行番号を返します。
エラーが生じた行番号を返します。 -
Psych
:: Visitors :: YAMLTree # tree -> Psych :: Nodes :: Stream|nil (28207.0) -
変換を終了し、構築した AST を返します。
...変換を終了し、構築した AST を返します。
内部で finish を呼び出し、変換処理を終了します。
このメソッドを2回以上呼ぶと、2回目以降は nil を返します。
@see Psych::Visitors::YAMLTree#finish... -
Psych
:: Handler # alias(anchor) -> () (27943.0) -
anchor という名前の alias を見付けたときに呼び出されます。
anchor という名前の alias を見付けたときに呼び出されます。
必要に応じてこのメソッドを override してください。
@param anchor aliasのアンカー文字列
=== 例
以下の YAMLドキュメントは自分自身への参照を持つ配列を表しています。
--- &ponies
- first element
- *ponies
この &ponies が anchor で *ponies が alias です。この場合、
alias メソッドは "poines" という引数で呼び出されます。 -
Psych
:: Nodes :: Alias # anchor -> String (27907.0) -
alias が指す先の anchor を返します。
...alias が指す先の anchor を返します。
@see Psych::Nodes::Alias#anchor=,
Psych::Nodes::Alias.new... -
Psych
:: Nodes :: Mapping # anchor -> String|nil (27907.0) -
mapping に付加された anchor を返します。
...mapping に付加された anchor を返します。
@see Psych::Nodes::Mapping#anchor=,
Psych::Nodes::Mapping.new... -
Psych
:: ScalarScanner # tokenize(string) -> object (27907.0) -
YAML の scalar である文字列を Ruby のオブジェクトに変換した ものを返します。
...YAML の scalar である文字列を Ruby のオブジェクトに変換した
ものを返します。
scanner = Psych::ScalarScanner.new
p scanner.tokenize("yes") # => true
p scanner.tokenize("year") # => "year"
p scanner.tokenize("12") # => 12
@param string 変換文字列... -
Psych
:: Visitors :: YAMLTree # start(encoding = Nodes :: Stream :: UTF8) -> Psych :: Nodes :: Stream (27907.0) -
Ruby オブジェクトから YAML AST への変換のための準備をします。
...す。
Psych::Visitors::YAMLTree#push が呼び出されたとき、
まだこのメソッドが呼び出されていなければ push メソッドがこの
メソッドを呼び出し、変換の準備をします。
encoding には以下のいずれかを指定できます。
* Psych::Nodes::......Node::UTF8
* Psych::Nodes::Node::UTF16BE
* Psych::Nodes::Node::UTF16LE
@param encoding YAML AST に設定するエンコーディング... -
Psych
:: Emitter # canonical -> bool (27607.0) -
出力の style が canonical であるならば真を返します。
...出力の style が canonical であるならば真を返します。
@see Psych::Emitter#canonical=... -
Psych
:: Handler # end _ mapping -> () (27607.0) -
mapping の終了の見付けたときに呼び出されます。
mapping の終了の見付けたときに呼び出されます。
必要に応じてこのメソッドを override してください。 -
Psych
:: Nodes :: Scalar # plain -> bool (27607.0) -
scalar が plain style であるかどうかを返します。
...scalar が plain style であるかどうかを返します。
@see Psych::Nodes::Scalar#plain=,
Psych::Nodes::Scalar.new... -
Psych
:: Stream # finish -> () (27607.0) -
YAML document への変換を完了し、io への出力を完了します。
YAML document への変換を完了し、io への出力を完了します。 -
Psych
:: TreeBuilder # root -> Psych :: Nodes :: Stream (27607.0) -
AST の root を返します。
...AST の root を返します。
@see Psych::Nodes::Stream... -
Psych
:: Visitors :: YAMLTree # started -> bool (27607.0) -
Psych::Visitors::YAMLTree#start をすでに呼び出しているならば 真を返します。
...Psych::Visitors::YAMLTree#start をすでに呼び出しているならば
真を返します。
まだならば偽を返します。... -
Psych
:: Visitors :: YAMLTree # started? -> bool (27607.0) -
Psych::Visitors::YAMLTree#start をすでに呼び出しているならば 真を返します。
...Psych::Visitors::YAMLTree#start をすでに呼び出しているならば
真を返します。
まだならば偽を返します。... -
Psych
:: Visitors :: YAMLTree (27043.0) -
Ruby オブジェクトから YAML の AST を構築するためのクラスです。
...クトから YAML の AST を構築するためのクラスです。
=== 例
builder = Psych::Visitors::YAMLTree.new
builder << { :foo => 'bar' }
builder << ["baz", "bazbaz"]
builder.tree # => #<Psych::Nodes::Stream ... > A stream containing two documents
puts tree.to_yaml
# =>
# ---... -
Psych
. parse(yaml , filename = nil) -> Psych :: Nodes :: Document (19243.0) -
YAML ドキュメントをパースし、YAML の AST を返します。
...用います。
AST については Psych::Nodes を参照してください。
@param yaml YAML ドキュメント(文字列 or IO オブジェクト)
@param filename Psych::SyntaxError 発生時にファイル名として表示する文字列。
@raise Psych::SyntaxError YAMLドキュメント......に文法エラーが発見されたときに発生します
@see Psych.load
//emlist[例][ruby]{
Psych.parse("---\n - a\n - b") # => #<Psych::Nodes::Document:...>
begin
Psych.parse("--- `", "file.txt")
rescue Psych::SyntaxError => ex
p ex.file # => 'file.txt'
p ex.message # => "(file.txt... -
Psych
. load _ stream(yaml , filename=nil) -> [object] (19207.0) -
複数の YAML ドキュメントを含むデータを Ruby のオブジェクトに変換します。
...を返します。
//emlist[例][ruby]{
Psych.load_stream("--- foo\n...\n--- bar\n...") # => ['foo', 'bar']
//}
ブロックありの場合は各オブジェクト引数としてそのブロックを呼び出します。
//emlist[例][ruby]{
list = []
Psych.load_stream("--- foo\n...\n--- bar\n.........に用います。
@param yaml YAML ドキュメント(文字列 or IO オブジェクト)
@param filename Psych::SyntaxError 発生時にファイル名として表示する文字列。
@raise Psych::SyntaxError YAMLドキュメントに文法エラーが発見されたときに発生します... -
Psych
. load _ stream(yaml , filename=nil) {|obj| . . . } -> () (19207.0) -
複数の YAML ドキュメントを含むデータを Ruby のオブジェクトに変換します。
...を返します。
//emlist[例][ruby]{
Psych.load_stream("--- foo\n...\n--- bar\n...") # => ['foo', 'bar']
//}
ブロックありの場合は各オブジェクト引数としてそのブロックを呼び出します。
//emlist[例][ruby]{
list = []
Psych.load_stream("--- foo\n...\n--- bar\n.........に用います。
@param yaml YAML ドキュメント(文字列 or IO オブジェクト)
@param filename Psych::SyntaxError 発生時にファイル名として表示する文字列。
@raise Psych::SyntaxError YAMLドキュメントに文法エラーが発見されたときに発生します... -
Psych
:: Handler # scalar(value , anchor , tag , plain , quoted , style) -> () (18979.0) -
スカラー値を見付けたときに呼び出されます。
...数値で渡されます。
style は次の値のいずれかです。
* Psych::Nodes::Scalar::PLAIN
* Psych::Nodes::Scalar::SINGLE_QUOTED
* Psych::Nodes::Scalar::DOUBLE_QUOTED
* Psych::Nodes::Scalar::LITERAL
* Psych::Nodes::Scalar::FOLDED
必要に応じてこのメソッドを override... -
Psych
:: Handler # start _ sequence(anchor , tag , implicit , style) -> () (18961.0) -
sequence の開始を見付けたときに呼び出されます。
...偽値で渡されます。
style には sequence の style が整数値で渡されます。以下のいずれか
です。
* Psych::Nodes::Sequence::BLOCK
* Psych::Nodes::Sequence::FLOW
必要に応じてこのメソッドを override してください。
@param anchor 関連付けられ... -
Psych
:: Handler # start _ document(version , tag _ directives , implicit) -> () (18943.0) -
YAML ドキュメントの始まりで呼び出されます。
YAML ドキュメントの始まりで呼び出されます。
version には YAML ドキュメントに宣言されているバージョンが
[major, minor] という配列で渡されます。宣言がない場合は空の配列が渡されます。
tag_directives には tag directive の配列が渡されます。
それぞれの tag は [prefix, suffix] という配列で表現されます。
implicit にはドキュメントが implicit に始まっているかどうかが
真偽値で渡されます。
必要に応じてこのメソッドを override してください。
@param version ... -
Psych
. dump _ stream(*objects) -> String (18907.0) -
オブジェクト列を YAML ドキュメント列に変換します。
...オブジェクト列を YAML ドキュメント列に変換します。
@param objects 変換対象のオブジェクト列
//emlist[例][ruby]{
Psych.dump_stream("foo\n ", {}) # => "--- ! \"foo\\n \"\n--- {}\n"
//}... -
Psych
:: Emitter . new(io) -> Psych :: Emitter (18907.0) -
Emitter オブジェクトを生成して返します。
Emitter オブジェクトを生成して返します。
@param io 出力先の IO オブジェクト -
Psych
:: Handler # start _ stream(encoding) -> () (18907.0) -
YAML ストリームの始まりで呼び出されます。
...されます。
encoding にはストリームのエンコーディング(以下のいずれか)が渡されます。
* Psych::Parser::UTF8
* Psych::Parser::UTF16BE
* Psych::Parser::UTF16LE
このメソッドは YAML のストリームごとに呼び出されます。一つのストリーム... -
Psych
:: Nodes :: Scalar # anchor -> String|nil (18907.0) -
scalar に付加された anchor を返します。
...scalar に付加された anchor を返します。
@see Psych::Nodes::Scalar#anchor=,
Psych::Nodes::Scalar.new... -
Psych
:: Nodes :: Sequence # anchor -> String|nil (18907.0) -
sequence に付加された anchor を返します。
...sequence に付加された anchor を返します。
@see Psych::Nodes::Sequence#anchor=,
Psych::Nodes::Sequence.new... -
Psych
:: Stream # start(encoding = Psych :: Nodes :: Stream :: UTF8) -> Psych :: Stream (18907.0) -
Ruby オブジェクトを YAML document に変換するための準備をします。
...Ruby オブジェクトを YAML document に変換するための準備をします。
変換された document は Psych::Stream.new で指定した
出力先に出力されます。
finish を呼び出すことで出力が完了します(finish を呼び出さないと
最後まで出力され... -
Psych
:: Stream # start(encoding = Psych :: Nodes :: Stream :: UTF8) {|em| . . . } -> Psych :: Stream (18907.0) -
Ruby オブジェクトを YAML document に変換するための準備をします。
...Ruby オブジェクトを YAML document に変換するための準備をします。
変換された document は Psych::Stream.new で指定した
出力先に出力されます。
finish を呼び出すことで出力が完了します(finish を呼び出さないと
最後まで出力され... -
Psych
:: SyntaxError # problem -> String (18907.0) -
生じたエラーの中身を文字列で返します。
生じたエラーの中身を文字列で返します。 -
Psych
:: TreeBuilder . new -> Psych :: TreeBuilder (18907.0) -
TreeBuilder オブジェクトを生成します。
TreeBuilder オブジェクトを生成します。 -
Psych
:: Visitors :: YAMLTree . new(options = {} , emitter = Psych :: TreeBuilder . new , ss = Psych :: ScalarScanner . new) -> Psych :: Visitors :: YAMLTree (18907.0) -
YAMLTree オブジェクトを生成します。
...定します。
Psych.dump と同じオプションが指定できます。
emitter には AST の構築に使われる Psych::TreeBuilder オブジェクト
を渡します。
ss は Ruby の String が YAML document 上で quote が必要かどうか
を判定するための Psych::ScalarScanner......常デフォルトのものから変える必要はないでしょう。
@param options オプション
@param emitter AST の構築に使う Psych::TreeBuilder オブジェクト
@param ss 文字列に quite が必要かどうかを判定するための Psych::ScalarScanner オブジェクト... -
Psych
:: Nodes :: Mapping . new(anchor=nil , tag=nil , implicit=true , style=BLOCK) -> Psych :: Nodes :: Mapping (10207.0) -
新たな mapping オブジェクトを生成します。
...AML ドキュメント上の style を整数で指定します。以下のいずれ
かを指定できます。
* Psych::Nodes::Mapping::ANY
* Psych::Nodes::Mapping::BLOCK
* Psych::Nodes::Mapping::FLOW
@param anchor mapping に付加された anchor
@param tag mapping に付加された tag
@... -
Psych
:: Nodes :: Scalar . new(value , anchor=nil , tag=nil , plain=true , quoted=false , style=ANY) -> Psych :: Nodes:Scalar (10207.0) -
Scalar オブジェクトを生成します。
...します。
style は次の値のいずれかです。
* Psych::Nodes::Scalar::ANY
* Psych::Nodes::Scalar::PLAIN
* Psych::Nodes::Scalar::SINGLE_QUOTED
* Psych::Nodes::Scalar::DOUBLE_QUOTED
* Psych::Nodes::Scalar::LITERAL
* Psych::Nodes::Scalar::FOLDED
@param value スカラー値
@para... -
Psych
:: Nodes :: Stream . new(encoding = Psych :: Nodes :: Stream :: UTF8) -> Psych :: Nodes :: Stream (10207.0) -
Psych::Nodes::Stream オブジェクトを生成して返します。
...
Psych::Nodes::Stream オブジェクトを生成して返します。
encoding には stream に使われるエンコーディングを指定します。
以下のいずれかを指定します。
* Psych::Nodes::Node::UTF8
* Psych::Nodes::Node::UTF16BE
* Psych::Nodes::Node::UTF16LE
@param... -
Psych
:: Parser :: UTF16BE -> Integer (9955.0) -
UTF-16BE エンコーディングを表します。
...UTF-16BE エンコーディングを表します。
@see Psych::Handler#start_stream... -
Psych
:: Parser :: UTF16LE -> Integer (9955.0) -
UTF-16LE エンコーディングを表します。
...UTF-16LE エンコーディングを表します。
@see Psych::Handler#start_stream... -
Psych
:: Parser :: UTF8 -> Integer (9955.0) -
UTF-8 エンコーディングを表します。
...UTF-8 エンコーディングを表します。
@see Psych::Handler#start_stream... -
Kernel
# psych _ y(*objects) -> String (9907.0) -
objects を YAML document に変換します。
...のメソッドは irb 上でのみ定義されます。
syck に y メソッドがあるため、
psych_y が別名として定義されています。将来的に
syck が廃止された場合 psych_y は廃止
される予定であるため、特別の事情がない限り y を用いてくだ... -
Kernel
# y(*objects) -> String (9907.0) -
objects を YAML document に変換します。
...のメソッドは irb 上でのみ定義されます。
syck に y メソッドがあるため、
psych_y が別名として定義されています。将来的に
syck が廃止された場合 psych_y は廃止
される予定であるため、特別の事情がない限り y を用いてくだ... -
Psych
:: Nodes :: Alias . new(anchor) -> Psych :: Nodes :: Alias (9907.0) -
新たな Alias オブジェクトを生成します。
新たな Alias オブジェクトを生成します。
anchor で指す先の anchor を指定します。
@param anchor 指す先の anchor -
Psych
:: Nodes :: Mapping # style -> Integer (9907.0) -
mapping の style を返します。
...mapping の style を返します。
@see Psych::Nodes::Mapping#style=,
Psych::Nodes::Mapping.new... -
Psych
:: Nodes :: Mapping # tag -> String|nil (9907.0) -
mapping に付加された tag を返します。
...mapping に付加された tag を返します。
@see Psych::Nodes::Mapping#tag=,
Psych::Nodes::Mapping.new... -
Psych
:: Nodes :: Mapping :: ANY -> Integer (9907.0) -
「任意」のスタイルを意味します。
...「任意」のスタイルを意味します。
emitter が適当に style を決めます。
@see Psych::Nodes::Mapping.new,
Psych::Nodes::Mapping#style,
Psych::Handler#start_mapping... -
Psych
:: Nodes :: Mapping :: BLOCK -> Integer (9907.0) -
block style を表します。
...block style を表します。
@see Psych::Nodes::Mapping.new,
Psych::Nodes::Mapping#style,
Psych::Handler#start_mapping... -
Psych
:: Nodes :: Mapping :: FLOW -> Integer (9907.0) -
flow style を表します。
...flow style を表します。
@see Psych::Nodes::Mapping.new,
Psych::Nodes::Mapping#style,
Psych::Handler#start_mapping... -
Psych
:: Nodes :: Scalar # style -> Integer (9907.0) -
scalar の style を返します。
...scalar の style を返します。
@see Psych::Nodes::Scalar#style=,
Psych::Nodes::Scalar.new... -
Psych
:: Nodes :: Scalar # tag -> String|nil (9907.0) -
scalar に付加された tag を返します。
...scalar に付加された tag を返します。
@see Psych::Nodes::Scalar#tag=,
Psych::Nodes::Scalar.new... -
Psych
:: Nodes :: Scalar # value -> String (9907.0) -
scalar の値を返します。
...scalar の値を返します。
@see Psych::Nodes::Scalar#value=,
Psych::Nodes::Scalar.new... -
Psych
:: Nodes :: Scalar :: ANY -> Integer (9907.0) -
「任意」のスタイルを意味します。
...「任意」のスタイルを意味します。
emitter が適当に style を決めます。
@see Psych::Nodes::Scalar.new,
Psych::Nodes::Scalar#style... -
Psych
:: Nodes :: Scalar :: DOUBLE _ QUOTED -> Integer (9907.0) -
double quoted style を表します。
...double quoted style を表します。
@see Psych::Nodes::Scalar.new,
Psych::Nodes::Scalar#style,
Psych::Handler#scalar... -
Psych
:: Nodes :: Scalar :: FOLDED -> Integer (9907.0) -
folded style を表します。
...folded style を表します。
@see Psych::Nodes::Scalar.new,
Psych::Nodes::Scalar#style,
Psych::Handler#scalar... -
Psych
:: Nodes :: Stream :: ANY -> Integer (9907.0) -
任意のエンコーディングを表す値。
...任意のエンコーディングを表す値。
Psych::Parser::ANY と同じ値です。... -
Psych
:: Nodes :: Stream :: UTF16BE -> Integer (9907.0) -
UTF16BE エンコーディングを表します。
...UTF16BE エンコーディングを表します。
Psych::Parser::UTF16BE と同じ値です。
@see Psych::Nodes::Stream.new... -
Psych
:: Nodes :: Stream :: UTF16LE -> Integer (9907.0) -
UTF16LE エンコーディングを表します。
...UTF16LE エンコーディングを表します。
Psych::Parser::UTF16LE と同じ値です。
@see Psych::Nodes::Stream.new... -
Psych
:: Nodes :: Stream :: UTF8 -> Integer (9907.0) -
UTF8 エンコーディングを表します。
...UTF8 エンコーディングを表します。
Psych::Parser::UTF8 と同じ値です。
@see Psych::Nodes::Stream.new... -
Psych
:: Parser :: ANY -> Integer (9907.0) -
「任意の」エンコーディングを意味します。
「任意の」エンコーディングを意味します。 -
Psych
:: Parser :: Mark # column -> Integer (9907.0) -
行の先頭からの文字数。
行の先頭からの文字数。 -
Psych
:: Stream . new(io) -> Psych :: Stream (9907.0) -
新たな Stream オブジェクトを生成します。
新たな Stream オブジェクトを生成します。
io で YAML document の出力先を指定します。
@param io 出力先の IO オブジェクト -
Psych
:: SyntaxError # column -> Integer (9907.0) -
エラーが生じた行内の位置を返します。
エラーが生じた行内の位置を返します。 -
Psych
:: SyntaxError # context -> String (9907.0) -
エラーが生じたコンテキストを文字列で返します。
エラーが生じたコンテキストを文字列で返します。 -
Psych
:: SyntaxError # offset -> Integer (9907.0) -
エラーが生じた位置の offset をバイト数で 返します。
...エラーが生じた位置の offset をバイト数で
返します。
offset とは、
Psych::SyntaxError#line, Psych::SyntaxError#column
で指示される位置からの相対位置です。
この位置から 0 バイトの位置でエラーが発生することが多いため、
このメ... -
Psych
:: Handler # end _ document(implicit) -> () (9607.0) -
ドキュメントが終了したときに呼び出されます。
ドキュメントが終了したときに呼び出されます。
ドキュメントが implicit に終わったならば implicit には真が渡されます。
必要に応じてこのメソッドを override してください。
@param implicit ドキュメントが implicit に終わったかどうか
=== 例
以下の YAML ドキュメントでは implicit は true です。
---
hello world
また、以下の YAML ドキュメントでは implicit は false です。
---
hello world
... -
Psych
. safe _ load(yaml , legacy _ permitted _ classes=[] , legacy _ permitted _ symbols=[] , legacy _ aliases=false , legacy _ filename=nil) -> object (1507.0) -
安全に YAML フォーマットの文書を読み込み Ruby のオブジェクトを生成して返します。
...えば Date クラスを許可するには
以下のように書いてください:
//emlist[permitted_classes: に Date を渡した例][ruby]{
Psych.safe_load(yaml, permitted_classes: [Date])
//}
すると上のクラス一覧に加えて Date クラスが読み込まれます。
エイリア......の例][ruby]{
x = []
x << x
yaml = Psych.dump x
Psych.safe_load yaml # => 例外発生
Psych.safe_load yaml, aliases: true # => エイリアスが読み込まれる
//}
yaml に許可されていないクラスが含まれていた場合は、
Psych::DisallowedClass 例外が発生......します。
yaml がエイリアスを含んでいてキーワード引数 aliases が false の時、
Psych::BadAlias 例外が発生します。
filename はパース中に発生した例外のメッセージに用います。
キーワード引数 symbolize_names に true を指定した場... -
Psych
. safe _ load(yaml , permitted _ classes: [] , permitted _ symbols: [] , aliases: false , filename: nil , fallback: nil , symbolize _ names: false) -> object (1507.0) -
安全に YAML フォーマットの文書を読み込み Ruby のオブジェクトを生成して返します。
...えば Date クラスを許可するには
以下のように書いてください:
//emlist[permitted_classes: に Date を渡した例][ruby]{
Psych.safe_load(yaml, permitted_classes: [Date])
//}
すると上のクラス一覧に加えて Date クラスが読み込まれます。
エイリア......の例][ruby]{
x = []
x << x
yaml = Psych.dump x
Psych.safe_load yaml # => 例外発生
Psych.safe_load yaml, aliases: true # => エイリアスが読み込まれる
//}
yaml に許可されていないクラスが含まれていた場合は、
Psych::DisallowedClass 例外が発生......します。
yaml がエイリアスを含んでいてキーワード引数 aliases が false の時、
Psych::BadAlias 例外が発生します。
filename はパース中に発生した例外のメッセージに用います。
キーワード引数 symbolize_names に true を指定した場... -
Psych
:: Nodes :: Node # to _ yaml(io=nil , options={}) -> String | IO (1507.0) -
AST を YAML ドキュメントに変換します。
...返り値として返します。
io を省略した(nil を指定した)場合には変換後のドキュメントを
文字列で返します。
Psych::Nodes::Stream 以外を変換しようとすると、AST として不正で
あるためエラーが発生します。
options には以下が... -
Psych
:: Nodes :: Node # yaml(io=nil , options={}) -> String | IO (1507.0) -
AST を YAML ドキュメントに変換します。
...返り値として返します。
io を省略した(nil を指定した)場合には変換後のドキュメントを
文字列で返します。
Psych::Nodes::Stream 以外を変換しようとすると、AST として不正で
あるためエラーが発生します。
options には以下が... -
Psych
:: Nodes :: Sequence . new(anchor=nil , tag=nil , implicit=true , style=BLOCK) -> Psych :: Nodes :: Sequence (1207.0) -
新たな sequence オブジェクトを生成します。
...ML ドキュメント上の style を整数で指定します。以下のいずれ
かを指定できます。
* Psych::Nodes::Sequence::ANY
* Psych::Nodes::Sequence::BLOCK
* Psych::Nodes::Sequence::FLOW
@param anchor sequence に付加された anchor
@param tag sequence に付加された t... -
Psych
. dump(o , options = {}) -> String (997.0) -
Ruby のオブジェクト o を YAML ドキュメントに変換します。
...[例][ruby]{
# Dump an array, get back a YAML string
Psych.dump(['a', 'b']) # => "---\n- a\n- b\n"
# Dump an array to an IO object
Psych.dump(['a', 'b'], StringIO.new) # => #<StringIO:0x000001009d0890>
# Dump an array with indentation set
Psych.dump(['a', ['b']], :indentation => 3) # => "---\n-......a\n- - b\n"
# Dump an array to an IO with indentation set
Psych.dump(['a', ['b']], StringIO.new, :indentation => 3)
//}... -
Psych
:: Nodes :: Node # tag -> String | nil (943.0) -
ノードに付加されたタグを返します。
...ノードに付加されたタグを返します。
タグが付加されていない場合は nil を返します。
ast = Psych.parse(<<EOS)
---
- !!str a
- b
EOS
p ast.root.children[0].value # => "a"
p ast.root.children[0].tag # => "tag:yaml.org,2002:str"
p ast.root.ch... -
Object
# psych _ to _ yaml(options = {}) -> String (907.0) -
オブジェクトを YAML document に変換します。
...ョンを指定できます。
Psych.dump と同じなので詳しくはそちらを参照してください。
syck に to_yaml メソッドがあるため、
psych_to_yaml が別名として定義されています。将来的に
syck が廃止された場合 psych_to_yaml は廃止
される予......定であるため、特別の事情がない限り to_yaml を用いてください。
@param options 出力オプション
@see Psych.dump... -
Object
# to _ yaml(options = {}) -> String (907.0) -
オブジェクトを YAML document に変換します。
...ョンを指定できます。
Psych.dump と同じなので詳しくはそちらを参照してください。
syck に to_yaml メソッドがあるため、
psych_to_yaml が別名として定義されています。将来的に
syck が廃止された場合 psych_to_yaml は廃止
される予......定であるため、特別の事情がない限り to_yaml を用いてください。
@param options 出力オプション
@see Psych.dump... -
Psych
. to _ json(o) -> String (907.0) -
Ruby のオブジェクト o を JSON の文字列に変換します。
Ruby のオブジェクト o を JSON の文字列に変換します。
@param o 変換対象となるオブジェクト -
Psych
:: Nodes :: Document . new(version=[] , tag _ directives=[] , implicit=false) -> Psych :: Nodes :: Document (907.0) -
Document オブジェクトを生成します。
...YAML 1.1 のドキュメントで、
tag directive を1つ持ち、 implicit にドキュメントが開始
している Document オブジェクトを生成しています。
Psych::Nodes::Document.new(
[1,1],
tenderlovemaking.com,2009:",
true)
@see Psych::Handler#start_document... -
Psych
:: Nodes :: Sequence # style -> Integer (907.0) -
sequence の style を返します。
...sequence の style を返します。
@see Psych::Nodes::Sequence#style=,
Psych::Nodes::Sequence.new... -
Psych
:: Nodes :: Sequence # tag -> String|nil (907.0) -
sequence に付加された tag を返します。
...sequence に付加された tag を返します。
@see Psych::Nodes::Sequence#tag=,
Psych::Nodes::Sequence.new... -
Psych
:: Nodes :: Sequence :: ANY -> Integer (907.0) -
「任意」のスタイルを意味します。
...「任意」のスタイルを意味します。
emitter が適当に style を決めます。
@see Psych::Nodes::Sequence.new,
Psych::Nodes::Sequence#style,
Psych::Handler#start_sequence... -
Psych
:: Nodes :: Sequence :: BLOCK -> Integer (907.0) -
block style を表します。
...block style を表します。
@see Psych::Nodes::Sequence.new,
Psych::Nodes::Sequence#style,
Psych::Handler#start_sequence... -
Psych
:: Nodes :: Sequence :: FLOW -> Integer (907.0) -
flow style を表します。
...flow style を表します。
@see Psych::Nodes::Sequence.new,
Psych::Nodes::Sequence#style...