るりまサーチ

最速Rubyリファレンスマニュアル検索!
55件ヒット [1-55件を表示] (0.020秒)
トップページ > ライブラリ:psych[x] > クエリ:psych[x] > クエリ:new[x] > クエリ:dump[x]

別のキーワード

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

クラス

モジュール

キーワード

検索結果

Psych.dump(o, io, options = {}) -> () (35188.0)

Ruby のオブジェクト o を YAML ドキュメントに変換します。

...ョン

//emlist[例][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 (35188.0)

Ruby のオブジェクト o を YAML ドキュメントに変換します。

...ョン

//emlist[例][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::Visitors::YAMLTree.new(options = {}, emitter = Psych::TreeBuilder.new, ss = Psych::ScalarScanner.new) -> Psych::Visitors::YAMLTree (29644.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 (11198.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 の下にありま...
...つリストの 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 << seq...

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

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

...re '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 with class Foo
Foo.yaml_as("tag:example.com,2013:foo")
# ... and dumps th...
...e 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:0x0000000130f48 @x=8>...

絞り込み条件を変える