種類
- インスタンスメソッド (36)
- 特異メソッド (12)
- 定数 (11)
- クラス (4)
クラス
-
Psych
:: Handler (5) -
Psych
:: Nodes :: Document (10) -
Psych
:: Nodes :: Mapping (1) -
Psych
:: Nodes :: Node (3) -
Psych
:: Nodes :: Scalar (7) -
Psych
:: Nodes :: Sequence (12) -
Psych
:: Nodes :: Stream (4) -
Psych
:: Parser (3) -
Psych
:: Parser :: Mark (1) -
Psych
:: Stream (2) -
Psych
:: SyntaxError (1) -
Psych
:: TreeBuilder (2) -
Psych
:: Visitors :: YAMLTree (3)
モジュール
- Psych (5)
キーワード
- ANY (1)
- BLOCK (1)
-
DOUBLE
_ QUOTED (1) - Document (1)
- FLOW (1)
- Mapping (1)
-
SINGLE
_ QUOTED (1) - Sequence (1)
- TreeBuilder (1)
- UTF16BE (2)
- UTF16LE (2)
- UTF8 (2)
- anchor (1)
- anchor= (1)
- column (2)
- dump (2)
-
dump
_ stream (1) - each (1)
-
end
_ document (1) -
end
_ sequence (1) - implicit (2)
- implicit= (2)
-
implicit
_ end (1) -
implicit
_ end= (1) - new (7)
- parse (1)
-
parse
_ file (1) - push (1)
- quoted (1)
- quoted= (1)
- root (2)
- scalar (1)
- start (3)
-
start
_ document (1) -
start
_ sequence (1) - style (1)
- style= (1)
- tag (1)
- tag= (1)
-
tag
_ directives (1) -
tag
_ directives= (1) -
to
_ ruby (1) - transform (1)
- value (1)
- value= (1)
- version (1)
- version= (1)
検索結果
先頭5件
-
Psych
. dump(o , io , options = {}) -> () (18307.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
. dump(o , options = {}) -> String (18307.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
. dump _ stream(*objects) -> String (18307.0) -
オブジェクト列を YAML ドキュメント列に変換します。
...オブジェクト列を YAML ドキュメント列に変換します。
@param objects 変換対象のオブジェクト列
//emlist[例][ruby]{
Psych.dump_stream("foo\n ", {}) # => "--- ! \"foo\\n \"\n--- {}\n"
//}... -
Psych
:: Handler # end _ document(implicit) -> () (18307.0) -
ドキュメントが終了したときに呼び出されます。
ドキュメントが終了したときに呼び出されます。
ドキュメントが implicit に終わったならば implicit には真が渡されます。
必要に応じてこのメソッドを override してください。
@param implicit ドキュメントが implicit に終わったかどうか
=== 例
以下の YAML ドキュメントでは implicit は true です。
---
hello world
また、以下の YAML ドキュメントでは implicit は false です。
---
hello world
... -
Psych
:: Handler # end _ sequence -> () (18307.0) -
sequence の終了の見付けたときに呼び出されます。
sequence の終了の見付けたときに呼び出されます。
必要に応じてこのメソッドを override してください。 -
Psych
:: Handler # start _ document(version , tag _ directives , implicit) -> () (18307.0) -
YAML ドキュメントの始まりで呼び出されます。
YAML ドキュメントの始まりで呼び出されます。
version には YAML ドキュメントに宣言されているバージョンが
[major, minor] という配列で渡されます。宣言がない場合は空の配列が渡されます。
tag_directives には tag directive の配列が渡されます。
それぞれの tag は [prefix, suffix] という配列で表現されます。
implicit にはドキュメントが implicit に始まっているかどうかが
真偽値で渡されます。
必要に応じてこのメソッドを override してください。
@param version ... -
Psych
:: Handler # start _ sequence(anchor , tag , implicit , style) -> () (18307.0) -
sequence の開始を見付けたときに呼び出されます。
...偽値で渡されます。
style には sequence の style が整数値で渡されます。以下のいずれか
です。
* Psych::Nodes::Sequence::BLOCK
* Psych::Nodes::Sequence::FLOW
必要に応じてこのメソッドを override してください。
@param anchor 関連付けられ... -
Psych
:: Nodes :: Node # to _ ruby -> object (18307.0) -
AST を ruby のオブジェクトに変換します。
AST を ruby のオブジェクトに変換します。 -
Psych
:: Nodes :: Scalar # quoted -> bool (18307.0) -
scalar が quoted であるかどうかを返します。
...scalar が quoted であるかどうかを返します。
@see Psych::Nodes::Scalar#quoted=,
Psych::Nodes::Scalar.new... -
Psych
:: Nodes :: Scalar # quoted=(bool) (18307.0) -
scalar が quoted であるかどうかを変更します。
...scalar が quoted であるかどうかを変更します。
@param bool 設定する真偽値
@see Psych::Nodes::Scalar#quoted,
Psych::Nodes::Scalar.new... -
Psych
:: Nodes :: Scalar # value -> String (18307.0) -
scalar の値を返します。
...scalar の値を返します。
@see Psych::Nodes::Scalar#value=,
Psych::Nodes::Scalar.new... -
Psych
:: Nodes :: Scalar # value=(v) (18307.0) -
scalar の値を設定します。
...scalar の値を設定します。
@param v 設定する値
@see Psych::Nodes::Scalar#value,
Psych::Nodes::Scalar.new... -
Psych
:: Nodes :: Scalar :: DOUBLE _ QUOTED -> Integer (18307.0) -
double quoted style を表します。
...double quoted style を表します。
@see Psych::Nodes::Scalar.new,
Psych::Nodes::Scalar#style,
Psych::Handler#scalar... -
Psych
:: Nodes :: Scalar :: SINGLE _ QUOTED -> Integer (18307.0) -
single quoted style を表します。
...single quoted style を表します。
@see Psych::Nodes::Scalar.new,
Psych::Nodes::Scalar#style,
Psych::Handler#scalar... -
Psych
:: Nodes :: Stream :: UTF16BE -> Integer (18307.0) -
UTF16BE エンコーディングを表します。
...UTF16BE エンコーディングを表します。
Psych::Parser::UTF16BE と同じ値です。
@see Psych::Nodes::Stream.new... -
Psych
:: Nodes :: Stream :: UTF16LE -> Integer (18307.0) -
UTF16LE エンコーディングを表します。
...UTF16LE エンコーディングを表します。
Psych::Parser::UTF16LE と同じ値です。
@see Psych::Nodes::Stream.new... -
Psych
:: Nodes :: Stream :: UTF8 -> Integer (18307.0) -
UTF8 エンコーディングを表します。
...UTF8 エンコーディングを表します。
Psych::Parser::UTF8 と同じ値です。
@see Psych::Nodes::Stream.new... -
Psych
:: Parser :: Mark # column -> Integer (18307.0) -
行の先頭からの文字数。
行の先頭からの文字数。 -
Psych
:: Parser :: UTF16BE -> Integer (18307.0) -
UTF-16BE エンコーディングを表します。
...UTF-16BE エンコーディングを表します。
@see Psych::Handler#start_stream... -
Psych
:: Parser :: UTF16LE -> Integer (18307.0) -
UTF-16LE エンコーディングを表します。
...UTF-16LE エンコーディングを表します。
@see Psych::Handler#start_stream... -
Psych
:: Parser :: UTF8 -> Integer (18307.0) -
UTF-8 エンコーディングを表します。
...UTF-8 エンコーディングを表します。
@see Psych::Handler#start_stream... -
Psych
:: SyntaxError # column -> Integer (18307.0) -
エラーが生じた行内の位置を返します。
エラーが生じた行内の位置を返します。 -
Psych
:: Nodes :: Document (18007.0) -
YAML ドキュメントを表すクラスです。
...は Psych::Nodes::Stream の子ノードでなければ
なりません。このノードは1個の子ノードを持たなければなりません。
またこの子ノードは以下のいずれかである必要があります。
* Psych::Nodes::Sequence
* Psych::Nodes::Mapping
* Psych::Nod......es::Scalar
この唯一の子ノードは「ルート」とも呼ばれ、Psych::Nodes::Document#root で
アクセスすることができます。... -
Psych
:: Nodes :: Sequence (18007.0) -
YAML sequence http://yaml.org/spec/1.1/#sequence/syntax を表すクラスです。
...を付加することができます。
この例では Psych::Nodes::Sequence#anchor は "A" を返します。
%YAML 1.1
---
&A [
"This sequence",
"has an anchor"
]
tag を付けることもできます。この例では
Psych::Nodes::Sequence#tag は "tag:yaml.org,2002:seq"
(!s......s a tag"
]
Psych::Nodes::Sequence は 0 個以上の子ノードを持つことができます。
子ノードは以下のいずれかクラスのインスタンスでなければなりません。
* Psych::Nodes::Sequence
* Psych::Nodes::Mapping
* Psych::Nodes::Scalar
* Psych::Nodes::Ali... -
Psych
:: TreeBuilder (18007.0) -
YAML AST を構築するためのクラスです。
...す。
Psych::Parser.new に渡して YAML ドキュメントを YAML AST に変換する
ことができます。
また、Psych::Visitors::YAMLTree.new に渡して Ruby オブジェクト
を YAML AST に変換することもできます。
=== Example
parser = Psych::Parser.new Psych::Tree......Builder.new
parser.parse('--- foo')
parser.handler.root # => #<Psych::Nodes::Stream:0x00000001400000 ... >... -
Psych
:: Nodes :: Sequence . new(anchor=nil , tag=nil , implicit=true , style=BLOCK) -> Psych :: Nodes :: Sequence (9607.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
:: Nodes :: Document . new(version=[] , tag _ directives=[] , implicit=false) -> Psych :: Nodes :: Document (9307.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
:: TreeBuilder . new -> Psych :: TreeBuilder (9307.0) -
TreeBuilder オブジェクトを生成します。
TreeBuilder オブジェクトを生成します。 -
Psych
:: Visitors :: YAMLTree # push(object) (9307.0) -
変換対象の Ruby オブジェクトを追加します。
変換対象の Ruby オブジェクトを追加します。
@param object YAML AST へ変換する Ruby オブジェクト -
Psych
:: Nodes :: Document # implicit -> bool (9007.0) -
ドキュメントが implicit に始まっているかどうかを返します。
...ドキュメントが implicit に始まっているかどうかを返します。
@see Psych::Nodes::Document#implicit=,
Psych::Nodes::Document.new... -
Psych
:: Nodes :: Document # implicit=(bool) (9007.0) -
ドキュメントが implicit に始まっているかどうかを設定します。
...ドキュメントが implicit に始まっているかどうかを設定します。
@param bool ドキュメントが implicit に始まっているかどうかの設定値
@see Psych::Nodes::Document#implicit,
Psych::Nodes::Document.new... -
Psych
:: Nodes :: Document # implicit _ end -> bool (9007.0) -
ドキュメントが implicit に終わっているかどうかを返します。
...ドキュメントが implicit に終わっているかどうかを返します。
オブジェクト生成時のデフォルト値は true です。
@see Psych::Nodes::Document#implicit_end=... -
Psych
:: Nodes :: Document # implicit _ end=(bool) (9007.0) -
ドキュメントが implicit に終わっているかどうかを設定します。
...ドキュメントが implicit に終わっているかどうかを設定します。
@param bool ドキュメントが implicit に終わっているかどうかの設定値
@see Psych::Nodes::Document#implicit_end... -
Psych
:: Nodes :: Document # root -> Psych :: Nodes :: Node (9007.0) -
ルートノードを返します。
ルートノードを返します。 -
Psych
:: Nodes :: Document # tag _ directives -> [[String , String]] (9007.0) -
tag directive の配列を返します。
...tag directive の配列を返します。
@see Psych::Nodes::Document#tag_directives=,
Psych::Nodes::Document.new... -
Psych
:: Nodes :: Document # tag _ directives=(tags) (9007.0) -
tag directive の配列を設定します。
...tag directive の配列を設定します。
@param tags 設定する tag directive の配列
@see Psych::Nodes::Document#tag_directives,
Psych::Nodes::Document.new... -
Psych
:: Nodes :: Document # version -> [Integer] (9007.0) -
YAML ドキュメントのバージョンを返します。
...YAML ドキュメントのバージョンを返します。
@see Psych::Nodes::Document#version=,
Psych::Nodes::Document.new... -
Psych
:: Nodes :: Document # version=(ver) (9007.0) -
YAML ドキュメントのバージョンを設定します。
...YAML ドキュメントのバージョンを設定します。
@param ver 設定するバージョン
@see Psych::Nodes::Document#version,
Psych::Nodes::Document.new... -
Psych
:: Nodes :: Node # transform -> object (9007.0) -
AST を ruby のオブジェクトに変換します。
AST を ruby のオブジェクトに変換します。 -
Psych
:: Nodes :: Sequence # anchor -> String|nil (9007.0) -
sequence に付加された anchor を返します。
...sequence に付加された anchor を返します。
@see Psych::Nodes::Sequence#anchor=,
Psych::Nodes::Sequence.new... -
Psych
:: Nodes :: Sequence # anchor=(a) (9007.0) -
sequence に付加する anchor を設定します。
...sequence に付加する anchor を設定します。
@param a 設定する anchor
@see Psych::Nodes::Sequence#anchor,
Psych::Nodes::Sequence.new... -
Psych
:: Nodes :: Sequence # implicit -> bool (9007.0) -
sequence が implicit に開始されたかどうかを真偽値で返します。
...sequence が implicit に開始されたかどうかを真偽値で返します。
@see Psych::Nodes::Sequence#implicit=,
Psych::Nodes::Sequence.new... -
Psych
:: Nodes :: Sequence # implicit=(bool) (9007.0) -
sequence が implicit に開始されたかどうかを真偽値で設定します。
...sequence が implicit に開始されたかどうかを真偽値で設定します。
@param bool 設定値
@see Psych::Nodes::Sequence#implicit,
Psych::Nodes::Sequence.new... -
Psych
:: Nodes :: Sequence # style -> Integer (9007.0) -
sequence の style を返します。
...sequence の style を返します。
@see Psych::Nodes::Sequence#style=,
Psych::Nodes::Sequence.new... -
Psych
:: Nodes :: Sequence # style=(sty) (9007.0) -
sequence の style を設定します。
...sequence の style を設定します。
@param sty 設定する style
@see Psych::Nodes::Sequence#style,
Psych::Nodes::Sequence.new... -
Psych
:: Nodes :: Sequence # tag -> String|nil (9007.0) -
sequence に付加された tag を返します。
...sequence に付加された tag を返します。
@see Psych::Nodes::Sequence#tag=,
Psych::Nodes::Sequence.new... -
Psych
:: Nodes :: Sequence # tag=(t) (9007.0) -
sequence に付加する tag を設定します。
...sequence に付加する tag を設定します。
@param t 設定する tag
@see Psych::Nodes::Sequence#anchor=,
Psych::Nodes::Sequence.new... -
Psych
:: Nodes :: Sequence :: ANY -> Integer (9007.0) -
「任意」のスタイルを意味します。
...「任意」のスタイルを意味します。
emitter が適当に style を決めます。
@see Psych::Nodes::Sequence.new,
Psych::Nodes::Sequence#style,
Psych::Handler#start_sequence... -
Psych
:: Nodes :: Sequence :: BLOCK -> Integer (9007.0) -
block style を表します。
...block style を表します。
@see Psych::Nodes::Sequence.new,
Psych::Nodes::Sequence#style,
Psych::Handler#start_sequence... -
Psych
:: Nodes :: Sequence :: FLOW -> Integer (9007.0) -
flow style を表します。
...flow style を表します。
@see Psych::Nodes::Sequence.new,
Psych::Nodes::Sequence#style... -
Psych
:: TreeBuilder # root -> Psych :: Nodes :: Stream (9007.0) -
AST の root を返します。
...AST の root を返します。
@see Psych::Nodes::Stream... -
Psych
:: Nodes :: Scalar . new(value , anchor=nil , tag=nil , plain=true , quoted=false , style=ANY) -> Psych :: Nodes:Scalar (607.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
. parse(yaml , filename = nil) -> Psych :: Nodes :: Document (307.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
. parse _ file(filename) -> Psych :: Nodes :: Document (307.0) -
filename で指定したファイルをパースして YAML の AST を返します。
...filename で指定したファイルをパースして YAML の AST を返します。
@param filename パースするファイルの名前
@raise Psych::SyntaxError YAMLドキュメントに文法エラーが発見されたときに発生します... -
Psych
:: Handler # scalar(value , anchor , tag , plain , quoted , style) -> () (307.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
:: Nodes :: Mapping . new(anchor=nil , tag=nil , implicit=true , style=BLOCK) -> Psych :: Nodes :: Mapping (307.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 :: Node # each -> Enumerator (307.0) -
self のノードをルートとする部分木の各ノードを引数として ブロックを呼び出します。
self のノードをルートとする部分木の各ノードを引数として
ブロックを呼び出します。
ブロックを省略した場合は Enumerator を返します。 -
Psych
:: Nodes :: Stream . new(encoding = Psych :: Nodes :: Stream :: UTF8) -> Psych :: Nodes :: Stream (307.0) -
Psych::Nodes::Stream オブジェクトを生成して返します。
...
Psych::Nodes::Stream オブジェクトを生成して返します。
encoding には stream に使われるエンコーディングを指定します。
以下のいずれかを指定します。
* Psych::Nodes::Node::UTF8
* Psych::Nodes::Node::UTF16BE
* Psych::Nodes::Node::UTF16LE
@param... -
Psych
:: Stream # start(encoding = Psych :: Nodes :: Stream :: UTF8) -> Psych :: Stream (307.0) -
Ruby オブジェクトを YAML document に変換するための準備をします。
...Ruby オブジェクトを YAML document に変換するための準備をします。
変換された document は Psych::Stream.new で指定した
出力先に出力されます。
finish を呼び出すことで出力が完了します(finish を呼び出さないと
最後まで出力され... -
Psych
:: Stream # start(encoding = Psych :: Nodes :: Stream :: UTF8) {|em| . . . } -> Psych :: Stream (307.0) -
Ruby オブジェクトを YAML document に変換するための準備をします。
...Ruby オブジェクトを YAML document に変換するための準備をします。
変換された document は Psych::Stream.new で指定した
出力先に出力されます。
finish を呼び出すことで出力が完了します(finish を呼び出さないと
最後まで出力され... -
Psych
:: Visitors :: YAMLTree # start(encoding = Nodes :: Stream :: UTF8) -> Psych :: Nodes :: Stream (307.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
:: Visitors :: YAMLTree . new(options = {} , emitter = Psych :: TreeBuilder . new , ss = Psych :: ScalarScanner . new) -> Psych :: Visitors :: YAMLTree (307.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 (43.0) -
YAML の mapping http://yaml.org/spec/1.1/#mapping を表すクラスです。
...す。
Psych::Nodes::Mapping は 0 個以上の子ノードを持つことができます。
子ノードの個数は偶数でなければなりません。
子ノードは以下のいずれかクラスのインスタンスでなければなりません。
* Psych::Nodes::Sequence
* Psych::Node......s::Mapping
* Psych::Nodes::Scalar
* Psych::Nodes::Alias
子ノードは mapping のキーと値が交互に並んでいます。
ast = Psych.parse(<<EOS)
%YAML 1.1
---
x: y
u: v
EOS
p ast.root.children.map{|v| v.value } # => ["x", "y", "u", "v"]...