diff options
author | zverok <zverok.offline@gmail.com> | 2018-03-02 13:10:08 +0200 |
---|---|---|
committer | zverok <zverok.offline@gmail.com> | 2018-03-02 13:10:08 +0200 |
commit | 16adb0c29de3cd7a371f82b702244a7e510d32fc (patch) | |
tree | 24371ad203c72ca9887e637f2c664b135baf7f36 /lib | |
parent | 33123b7f6fb70376624bc5bc78db5f4d8635ba94 (diff) | |
download | psych-16adb0c29de3cd7a371f82b702244a7e510d32fc.tar.gz |
Document #dump options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/psych.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/psych.rb b/lib/psych.rb index ad87ece..a728dd7 100644 --- a/lib/psych.rb +++ b/lib/psych.rb @@ -418,6 +418,24 @@ module Psych # to control the output format. If an IO object is passed in, the YAML will # be dumped to that IO object. # + # Currently supported options are: + # + # [<tt>:indentation</tt>] Number of space characters used to indent. + # Acceptable value should be in <tt>0..9</tt> range, + # otherwise option is ignored. + # + # Default: <tt>2</tt>. + # [<tt>:line_width</tt>] Max character to wrap line at. + # + # Default: <tt>0</tt> (meaning "wrap at 81"). + # [<tt>:canonical</tt>] Write "canonical" YAML form (very verbose, yet + # strictly formal). + # + # Default: <tt>false</tt>. + # [<tt>:header</tt>] Write <tt>%YAML [version]</tt> at the beginning of document. + # + # Default: <tt>false</tt>. + # # Example: # # # Dump an array, get back a YAML string @@ -427,10 +445,10 @@ module Psych # 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" + # 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(['a', ['b']], StringIO.new, indentation: 3) def self.dump o, io = nil, options = {} if Hash === io options = io |