diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-19 00:36:42 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-19 00:36:42 +0000 |
commit | 1ec93d92c7130f5b56fc87b2d811b42e1a26b6a2 (patch) | |
tree | b723c625d53bae3eb8195b040464b9ea1319ea55 /ext/psych/lib/psych/handler.rb | |
parent | ac80ad663ee907115bae310ae7f4d0bee6611f0a (diff) |
* ext/psych/emitter.c (initialize): allow a configuration object to be
passed to the constructor so that mutation isn't required after
instantiation.
* ext/psych/lib/psych/handler.rb: add configuration object
* ext/psych/lib/psych/visitors/emitter.rb: use configuration object if
extra configuration is present.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych/lib/psych/handler.rb')
-rw-r--r-- | ext/psych/lib/psych/handler.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/psych/lib/psych/handler.rb b/ext/psych/lib/psych/handler.rb index a2aa6bb178..d3b99636c4 100644 --- a/ext/psych/lib/psych/handler.rb +++ b/ext/psych/lib/psych/handler.rb @@ -11,6 +11,21 @@ module Psych # See Psych::Parser for more details class Handler ### + # Configuration options for dumping YAML. + class DumperOptions + attr_accessor :line_width, :indentation, :canonical + + def initialize + @line_width = 0 + @indentation = 2 + @canonical = false + end + end + + # Default dumping options + OPTIONS = DumperOptions.new + + ### # Called with +encoding+ when the YAML stream starts. This method is # called once per stream. A stream may contain multiple documents. # |