るりまサーチ (Ruby 2.2.0)

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

別のキーワード

  1. psych any
  2. psych tag
  3. psych dump
  4. psych anchor

検索結果

Psych::Visitors::YAMLTree.new(options = {}, emitter = Psych::TreeBuilder.new, ss = Psych::ScalarScanner.new) -> Psych::Visitors::YAMLTree (88915.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::Stream.new(encoding = Psych::Nodes::Stream::UTF8) -> Psych::Nodes::Stream (88018.0)

Psych::Nodes::Stream オブジェクトを生成して返します。

...
Psych
::Nodes::Stream オブジェクトを生成して返します。

encoding には stream に使われるエンコーディングを指定します。
以下のいずれかを指定します。
* Psych::Nodes::Node::UTF8
* Psych::Nodes::Node::UTF16BE
* Psych::Nodes::Node::UTF16LE

@param...

Psych::Parser.new(handler = Handler.new) -> Psych::Parser (87934.0)

新たなパーサオブジェクトを生成して返します。

...新たなパーサオブジェクトを生成して返します。

handler で YAML のイベントを処理するハンドラを指定します。
詳しくは Psych::Parser を参照してください。

@param handler YAML のイベントを処理するハンドラ...

Psych::Nodes::Scalar.new(value, anchor=nil, tag=nil, plain=true, quoted=false, style=ANY) -> Psych::Nodes:Scalar (87721.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::Document.new(version=[], tag_directives=[], implicit=false) -> Psych::Nodes::Document (87667.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::Mapping.new(anchor=nil, tag=nil, implicit=true, style=BLOCK) -> Psych::Nodes::Mapping (87667.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::Sequence.new(anchor=nil, tag=nil, implicit=true, style=BLOCK) -> Psych::Nodes::Sequence (87667.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::Emitter.new(io) -> Psych::Emitter (87613.0)

Emitter オブジェクトを生成して返します。

Emitter オブジェクトを生成して返します。

@param io 出力先の IO オブジェクト

Psych::Nodes::Alias.new(anchor) -> Psych::Nodes::Alias (87613.0)

新たな Alias オブジェクトを生成します。

新たな Alias オブジェクトを生成します。

anchor で指す先の anchor を指定します。

@param anchor 指す先の anchor

Psych::Stream.new(io) -> Psych::Stream (87613.0)

新たな Stream オブジェクトを生成します。

新たな Stream オブジェクトを生成します。

io で YAML document の出力先を指定します。

@param io 出力先の IO オブジェクト

絞り込み条件を変える

Psych::TreeBuilder.new -> Psych::TreeBuilder (87613.0)

TreeBuilder オブジェクトを生成します。

TreeBuilder オブジェクトを生成します。

Psych::ScalarScanner.new (87310.0)

新たな ScalarScanner オブジェクトを生成します。

新たな ScalarScanner オブジェクトを生成します。

Psych.dump(o, io, options = {}) -> () (51115.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 (51115.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::Stream#start(encoding = Psych::Nodes::Stream::UTF8) -> Psych::Stream (33655.0)

Ruby オブジェクトを YAML document に変換するための準備をします。

...Ruby オブジェクトを YAML document に変換するための準備をします。

変換された document は Psych::Stream.new で指定した
出力先に出力されます。

finish を呼び出すことで出力が完了します(finish を呼び出さないと
最後まで出力され...

絞り込み条件を変える

Psych::Stream#start(encoding = Psych::Nodes::Stream::UTF8) {|em| ... } -> Psych::Stream (33655.0)

Ruby オブジェクトを YAML document に変換するための準備をします。

...Ruby オブジェクトを YAML document に変換するための準備をします。

変換された document は Psych::Stream.new で指定した
出力先に出力されます。

finish を呼び出すことで出力が完了します(finish を呼び出さないと
最後まで出力され...

Psych::Nodes (33577.0)

Psych が中間データとして利用している AST (Abstract Syntax Tree) に 関するモジュール。

...Psych が中間データとして利用している AST (Abstract Syntax Tree) に
関するモジュール。

Psych
.load によって YAML ドキュメントを Ruby オブジェクトに変換
するときには、一度中間的な AST に変換され、その AST が Ruby の
オブジェクト...
...

逆向き、つまり Psych.dump で Ruby のオブジェクトを
YAML ドキュメントに変換するときには、中間的な AST に変換してから
それを YAML ドキュメントに変換します。

YAML AST の各ノードのクラスはすべて Psych::Nodes の下にありま...
...を1つ持つリストの AST を構築しています。

# Create our nodes
stream = Psych::Nodes::Stream.new
doc = Psych::Nodes::Document.new
seq = Psych::Nodes::Sequence.new
scalar = Psych::Nodes::Scalar.new('foo')

# Build up our tree
stream.children << doc
doc.children...

Psych::Emitter (33325.0)

Psych::Parser でパースし、生じたイベントから YAML ドキュメントを再構築するようなハンドラです。

...Psych::Parser でパースし、生じたイベントから
YAML ドキュメントを再構築するようなハンドラです。

以下の例では STDIN から YAML ドキュメントを入力し、
再構築した YAML ドキュメントを STDERR に出力します。

parser = Psych::Pars...
...w(Psych::Emitter.new($stderr))
parser.parse($stdin)

また、以下のようにイベントを手動で発生させることで
YAML ドキュメントを構築させることもできます。
各メソッドの意味については Psych::Handler を参照してください。
require 'psych'...
...put = StringIO.new
emitter = Psych::Emitter.new(output)

emitter.start_stream(Psych::Parser::UTF8)
emitter.start_document([1, 1], [], false)
emitter.start_mapping(nil, nil, false, Psych::Nodes::Mapping::BLOCK)
emitter.scalar("a", nil, nil, true, false, Psych::Nodes::Scalar::PLAIN)
emit...

Psych::Parser (33259.0)

YAML のパーサ。

...ュメントを
別のフォーマット変換したりします。
Psych
::Emitter を使うとパースしたドキュメントを元通りに出力
することもできます。

Psych
::Parser が生成するイベントは Psych::Handler
を見てください。

以下の例では YAML ドキ...
...or detecting scalar values
class ScalarHandler < Psych::Handler
def scalar value, anchor, tag, plain, quoted, style
puts value
end
end

parser = Psych::Parser.new(ScalarHandler.new)
parser.parse(yaml_document)

次の例は Psych::Emitter にパースの結果を戻していま...
...力をパース→YAMLフォーマットで STDERR に出力
という流れになっています。

parser = Psych::Parser.new(Psych::Emitter.new($stderr))
parser.parse($stdin)

Psych
::Parser と Psych::TreeBuilder を組み合わせると
YAML の AST を構築することができます。...

Psych::TreeBuilder (33169.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::Stream (33115.0)

入力されたオブジェクトから変換された YAML document を指定した IO に出力する機能を持つクラスです。

...を完了します。
stream = Psych::Stream.new($stdout)
stream.start
stream.push({:foo => 'bar'})
stream.finish

YAML document は(バッファリングされずに)直接 $stdout に出力されます。

finish を確実に呼び出すためには Psych::Stream#start メソッドを
...
...ロック付きで呼び出すとよいでしょう。

stream = Psych::Stream.new($stdout)
stream.start do |em|
em.push(:foo => 'bar')
end

基本的な仕組みは Psych::Visitors::YAMLTree と似ています。...

Psych::Nodes::Mapping::ANY -> Integer (33079.0)

「任意」のスタイルを意味します。

...「任意」のスタイルを意味します。

emitter が適当に style を決めます。

@see Psych::Nodes::Mapping.new,
Psych
::Nodes::Mapping#style,
Psych
::Handler#start_mapping...

Psych::Nodes::Mapping::BLOCK -> Integer (33079.0)

block style を表します。

...block style を表します。

@see Psych::Nodes::Mapping.new,
Psych
::Nodes::Mapping#style,
Psych
::Handler#start_mapping...

Psych::Nodes::Mapping::FLOW -> Integer (33079.0)

flow style を表します。

...flow style を表します。

@see Psych::Nodes::Mapping.new,
Psych
::Nodes::Mapping#style,
Psych
::Handler#start_mapping...

Psych::Nodes::Scalar::DOUBLE_QUOTED -> Integer (33079.0)

double quoted style を表します。

...double quoted style を表します。

@see Psych::Nodes::Scalar.new,
Psych
::Nodes::Scalar#style,
Psych
::Handler#scalar...

絞り込み条件を変える

Psych::Nodes::Scalar::FOLDED -> Integer (33079.0)

folded style を表します。

...folded style を表します。

@see Psych::Nodes::Scalar.new,
Psych
::Nodes::Scalar#style,
Psych
::Handler#scalar...

Psych::Nodes::Scalar::LITERAL -> Integer (33079.0)

literal style を表します。

...literal style を表します。

@see Psych::Nodes::Scalar.new,
Psych
::Nodes::Scalar#style,
Psych
::Handler#scalar...

Psych::Nodes::Scalar::PLAIN -> Integer (33079.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 (33079.0)

single quoted style を表します。

...single quoted style を表します。

@see Psych::Nodes::Scalar.new,
Psych
::Nodes::Scalar#style,
Psych
::Handler#scalar...

Psych::Nodes::Sequence::ANY -> Integer (33079.0)

「任意」のスタイルを意味します。

...「任意」のスタイルを意味します。

emitter が適当に style を決めます。

@see Psych::Nodes::Sequence.new,
Psych
::Nodes::Sequence#style,
Psych
::Handler#start_sequence...

絞り込み条件を変える

Psych::Nodes::Sequence::BLOCK -> Integer (33079.0)

block style を表します。

...block style を表します。

@see Psych::Nodes::Sequence.new,
Psych
::Nodes::Sequence#style,
Psych
::Handler#start_sequence...

Psych::Parser#parse(yaml) -> self (33079.0)

YAML ドキュメントをパースし、イベントハンドラに イベントを逐次通知します。

...YAML ドキュメントをパースし、イベントハンドラに
イベントを逐次通知します。

@see Psych::Parser.new, Psych::Handler, Psych::Parser#handler...

Psych::Nodes::Alias#anchor -> String (33061.0)

alias が指す先の anchor を返します。

...alias が指す先の anchor を返します。

@see Psych::Nodes::Alias#anchor=,
Psych
::Nodes::Alias.new...

Psych::Nodes::Alias#anchor=(val) (33061.0)

alias が指す先の anchor を変更します。

...alias が指す先の anchor を変更します。

@param val 設定する anchor
@see Psych::Nodes::Alias#anchor,
Psych
::Nodes::Alias.new...

Psych::Nodes::Document#implicit -> bool (33061.0)

ドキュメントが implicit に始まっているかどうかを返します。

...ドキュメントが implicit に始まっているかどうかを返します。

@see Psych::Nodes::Document#implicit=,
Psych
::Nodes::Document.new...

絞り込み条件を変える

Psych::Nodes::Document#implicit=(bool) (33061.0)

ドキュメントが implicit に始まっているかどうかを設定します。

...ドキュメントが implicit に始まっているかどうかを設定します。

@param bool ドキュメントが implicit に始まっているかどうかの設定値
@see Psych::Nodes::Document#implicit,
Psych
::Nodes::Document.new...

Psych::Nodes::Document#tag_directives -> [[String, String]] (33061.0)

tag directive の配列を返します。

...tag directive の配列を返します。

@see Psych::Nodes::Document#tag_directives=,
Psych
::Nodes::Document.new...

Psych::Nodes::Document#tag_directives=(tags) (33061.0)

tag directive の配列を設定します。

...tag directive の配列を設定します。

@param tags 設定する tag directive の配列
@see Psych::Nodes::Document#tag_directives,
Psych
::Nodes::Document.new...

Psych::Nodes::Document#version -> [Integer] (33061.0)

YAML ドキュメントのバージョンを返します。

...YAML ドキュメントのバージョンを返します。

@see Psych::Nodes::Document#version=,
Psych
::Nodes::Document.new...

Psych::Nodes::Document#version=(ver) (33061.0)

YAML ドキュメントのバージョンを設定します。

...YAML ドキュメントのバージョンを設定します。

@param ver 設定するバージョン
@see Psych::Nodes::Document#version,
Psych
::Nodes::Document.new...

絞り込み条件を変える

Psych::Nodes::Mapping#anchor -> String|nil (33061.0)

mapping に付加された anchor を返します。

...mapping に付加された anchor を返します。

@see Psych::Nodes::Mapping#anchor=,
Psych
::Nodes::Mapping.new...

Psych::Nodes::Mapping#anchor=(a) (33061.0)

mapping に付加する anchor を設定します。

...mapping に付加する anchor を設定します。

@param a 設定する anchor
@see Psych::Nodes::Mapping#anchor,
Psych
::Nodes::Mapping.new...

Psych::Nodes::Mapping#implicit -> bool (33061.0)

mapping が implicit に開始されたかどうかを真偽値で返します。

...mapping が implicit に開始されたかどうかを真偽値で返します。

@see Psych::Nodes::Mapping#implicit=,
Psych
::Nodes::Mapping.new...

Psych::Nodes::Mapping#implicit=(bool) (33061.0)

mapping が implicit に開始されたかどうかを真偽値で設定します。

...mapping が implicit に開始されたかどうかを真偽値で設定します。

@param bool 設定値

@see Psych::Nodes::Mapping#implicit,
Psych
::Nodes::Mapping.new...

Psych::Nodes::Mapping#style -> Integer (33061.0)

mapping の style を返します。

...mapping の style を返します。

@see Psych::Nodes::Mapping#style=,
Psych
::Nodes::Mapping.new...

絞り込み条件を変える

Psych::Nodes::Mapping#style=(sty) (33061.0)

mapping の style を設定します。

...mapping の style を設定します。

@param sty 設定する style

@see Psych::Nodes::Mapping#style,
Psych
::Nodes::Mapping.new...

Psych::Nodes::Mapping#tag -> String|nil (33061.0)

mapping に付加された tag を返します。

...mapping に付加された tag を返します。

@see Psych::Nodes::Mapping#tag=,
Psych
::Nodes::Mapping.new...

Psych::Nodes::Mapping#tag=(t) (33061.0)

mapping に付加する tag を設定します。

...mapping に付加する tag を設定します。

@param t 設定する tag
@see Psych::Nodes::Mapping#anchor=,
Psych
::Nodes::Mapping.new...

Psych::Nodes::Scalar#anchor -> String|nil (33061.0)

scalar に付加された anchor を返します。

...scalar に付加された anchor を返します。

@see Psych::Nodes::Scalar#anchor=,
Psych
::Nodes::Scalar.new...

Psych::Nodes::Scalar#anchor=(a) (33061.0)

scalar に付加された anchor を変更します。

...scalar に付加された anchor を変更します。

@param a 設定する anchor
@see Psych::Nodes::Scalar#anchor,
Psych
::Nodes::Scalar.new...

絞り込み条件を変える

Psych::Nodes::Scalar#plain -> bool (33061.0)

scalar が plain style であるかどうかを返します。

...scalar が plain style であるかどうかを返します。


@see Psych::Nodes::Scalar#plain=,
Psych
::Nodes::Scalar.new...

Psych::Nodes::Scalar#plain=(bool) (33061.0)

scalar が plain style であるかどうかを変更します。

...scalar が plain style であるかどうかを変更します。

@param bool 設定する真偽値
@see Psych::Nodes::Scalar#plain,
Psych
::Nodes::Scalar.new...

Psych::Nodes::Scalar#quoted -> bool (33061.0)

scalar が quoted であるかどうかを返します。

...scalar が quoted であるかどうかを返します。

@see Psych::Nodes::Scalar#quoted=,
Psych
::Nodes::Scalar.new...

Psych::Nodes::Scalar#quoted=(bool) (33061.0)

scalar が quoted であるかどうかを変更します。

...scalar が quoted であるかどうかを変更します。

@param bool 設定する真偽値
@see Psych::Nodes::Scalar#quoted,
Psych
::Nodes::Scalar.new...

Psych::Nodes::Scalar#style -> Integer (33061.0)

scalar の style を返します。

...scalar の style を返します。

@see Psych::Nodes::Scalar#style=,
Psych
::Nodes::Scalar.new...

絞り込み条件を変える

Psych::Nodes::Scalar#style=(sty) (33061.0)

scalar の style を変更します。

...scalar の style を変更します。

@param sty 設定する style
@see Psych::Nodes::Scalar#style=,
Psych
::Nodes::Scalar.new...

Psych::Nodes::Scalar#tag -> String|nil (33061.0)

scalar に付加された tag を返します。

...scalar に付加された tag を返します。

@see Psych::Nodes::Scalar#tag=,
Psych
::Nodes::Scalar.new...

Psych::Nodes::Scalar#tag=(t) (33061.0)

scalar に付加された tag を変更します。

...scalar に付加された tag を変更します。

@param t 設定する tag
@see Psych::Nodes::Scalar#tag,
Psych
::Nodes::Scalar.new...

Psych::Nodes::Scalar#value -> String (33061.0)

scalar の値を返します。

...scalar の値を返します。

@see Psych::Nodes::Scalar#value=,
Psych
::Nodes::Scalar.new...

Psych::Nodes::Scalar#value=(v) (33061.0)

scalar の値を設定します。

...scalar の値を設定します。

@param v 設定する値
@see Psych::Nodes::Scalar#value,
Psych
::Nodes::Scalar.new...

絞り込み条件を変える

Psych::Nodes::Scalar::ANY -> Integer (33061.0)

「任意」のスタイルを意味します。

...「任意」のスタイルを意味します。

emitter が適当に style を決めます。

@see Psych::Nodes::Scalar.new,
Psych
::Nodes::Scalar#style...

Psych::Nodes::Sequence#anchor -> String|nil (33061.0)

sequence に付加された anchor を返します。

...sequence に付加された anchor を返します。

@see Psych::Nodes::Sequence#anchor=,
Psych
::Nodes::Sequence.new...

Psych::Nodes::Sequence#anchor=(a) (33061.0)

sequence に付加する anchor を設定します。

...sequence に付加する anchor を設定します。

@param a 設定する anchor
@see Psych::Nodes::Sequence#anchor,
Psych
::Nodes::Sequence.new...

Psych::Nodes::Sequence#implicit -> bool (33061.0)

sequence が implicit に開始されたかどうかを真偽値で返します。

...sequence が implicit に開始されたかどうかを真偽値で返します。

@see Psych::Nodes::Sequence#implicit=,
Psych
::Nodes::Sequence.new...

Psych::Nodes::Sequence#implicit=(bool) (33061.0)

sequence が implicit に開始されたかどうかを真偽値で設定します。

...sequence が implicit に開始されたかどうかを真偽値で設定します。

@param bool 設定値

@see Psych::Nodes::Sequence#implicit,
Psych
::Nodes::Sequence.new...

絞り込み条件を変える

Psych::Nodes::Sequence#style -> Integer (33061.0)

sequence の style を返します。

...sequence の style を返します。

@see Psych::Nodes::Sequence#style=,
Psych
::Nodes::Sequence.new...

Psych::Nodes::Sequence#style=(sty) (33061.0)

sequence の style を設定します。

...sequence の style を設定します。

@param sty 設定する style

@see Psych::Nodes::Sequence#style,
Psych
::Nodes::Sequence.new...

Psych::Nodes::Sequence#tag -> String|nil (33061.0)

sequence に付加された tag を返します。

...sequence に付加された tag を返します。

@see Psych::Nodes::Sequence#tag=,
Psych
::Nodes::Sequence.new...

Psych::Nodes::Sequence#tag=(t) (33061.0)

sequence に付加する tag を設定します。

...sequence に付加する tag を設定します。

@param t 設定する tag
@see Psych::Nodes::Sequence#anchor=,
Psych
::Nodes::Sequence.new...

Psych::Nodes::Sequence::FLOW -> Integer (33061.0)

flow style を表します。

...flow style を表します。

@see Psych::Nodes::Sequence.new,
Psych
::Nodes::Sequence#style...

絞り込み条件を変える

Psych::Nodes::Stream::UTF16BE -> Integer (33061.0)

UTF16BE エンコーディングを表します。

...UTF16BE エンコーディングを表します。

Psych
::Parser::UTF16BE と同じ値です。

@see Psych::Nodes::Stream.new...

Psych::Nodes::Stream::UTF16LE -> Integer (33061.0)

UTF16LE エンコーディングを表します。

...UTF16LE エンコーディングを表します。

Psych
::Parser::UTF16LE と同じ値です。

@see Psych::Nodes::Stream.new...

Psych::Nodes::Stream::UTF8 -> Integer (33061.0)

UTF8 エンコーディングを表します。

...UTF8 エンコーディングを表します。

Psych
::Parser::UTF8 と同じ値です。

@see Psych::Nodes::Stream.new...

Psych::Visitors::YAMLTree (33061.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::ScalarScanner#tokenize(string) -> object (33043.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 変換文字列...

絞り込み条件を変える

Object.yaml_tag(tag) -> () (24115.0)

クラスと tag の間を関連付けます。

...g 対象のクラスに関連付けるタグの文字列

=== Example
require 'psych'

class Foo
def initialize(x)
@x = x
end

attr_reader :x
end

# Dumps Ruby object normally
p Psych.dump(Foo.new(3))
# =>
# --- !ruby/object:Foo
# x: 3

# Registers tag...
...yaml_as("tag:example.com,2013:foo")
# ... and dumps the object of Foo class
Psych
.dump(Foo.new(3), STDOUT)
# =>
# --- !<tag:example.com,2013:foo>
# x: 3

# Loads the object from the tagged YAML node
p Psych.load(<<EOS)
--- !<tag:example.com,2012:foo>
x: 8
EOS
# => #<Foo:0x00...