diff options
-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 |