るりまサーチ (Ruby 2.4.0)

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

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

クラス

モジュール

キーワード

検索結果

Psych::Visitors::YAMLTree.new(options = {}, emitter = Psych::TreeBuilder.new, ss = Psych::ScalarScanner.new) -> Psych::Visitors::YAMLTree (54934.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.dump(o, io, options = {}) -> () (54493.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 (54493.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 (97.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...

Object.yaml_tag(tag) -> () (79.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...

絞り込み条件を変える