module Psych
クラスの継承リスト: Psych
要約
yaml のバックエンドのためのモジュールです。
特異メソッド
dump(o, io = nil, options = {})
-
[TODO]
Dump Ruby object +o+ to a YAML string. Optional +options+ may be passed in to control the output format. If an IO object is passed in, the YAML will be dumped to that IO object.
Example:
# 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)
dump_stream(*objects)
-
[TODO]
Dump a list of objects as separate documents to a document stream.
Example:
Psych.dump_stream("foo\n ", {}) # => "--- ! \"foo\\n \"\n--- {}\n"
libyaml_version
-
[TODO]
Returns the version of libyaml being used
load(yaml) -> object
-
[TODO]
Load +yaml+ in to a Ruby data structure. If multiple documents are provided, the object contained in the first document will be returned.
Example:
Psych.load("--- a") # => 'a' Psych.load("---\n - a\n - b") # => ['a', 'b']
load_file(filename)
-
[TODO]
Load the document contained in +filename+. Returns the yaml contained in +filename+ as a ruby object
load_stream(yaml)
-
[TODO]
Load multiple documents given in +yaml+. Returns the parsed documents as a list. For example:
Psych.load_stream("--- foo\n...\n--- bar\n...") # => ['foo', 'bar']
parse(yaml) -> object
-
[TODO]
Parse a YAML string in +yaml+. Returns the first object of a YAML AST.
Example:
Psych.parse("---\n - a\n - b") # => #<Psych::Nodes::Sequence:0x00>
Psych::Nodes for more information about YAML AST.
parse_file(filename) -> object
-
[TODO]
Parse a file at +filename+. Returns the YAML AST.
parse_stream(yaml)
-
[TODO]
Parse a YAML string in +yaml+. Returns the full AST for the YAML document. This method can handle multiple YAML documents contained in +yaml+.
Example:
Psych.parse_stream("---\n - a\n - b") # => #<Psych::Nodes::Stream:0x00>
See Psych::Nodes for more information about YAML AST.
parser -> Psych::Parser
-
[TODO]
Returns a default parser
to_json(o) -> String
-
[TODO]
Dump Ruby object +o+ to a JSON string.
定数
LIBYAML_VERSION -> String
-
[TODO]
The version of libyaml Psych is using
VERSION -> String
-
[TODO]
The version is Psych you're using