summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-10-03 14:02:30 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-10-03 14:02:30 -0700
commit68a91d5e6446cacac9ded1c03381244557b02e2e (patch)
tree928f74cb30383501608b6122b9fe614891083ac4
parent89ff7307924cc94a52bafe13867d975077b5a429 (diff)
downloadpsych-68a91d5e6446cacac9ded1c03381244557b02e2e.zip
* ext/psych/lib/psych/visitors/to_ruby.rb: ToRuby visitor can be
constructed with a ScalarScanner. * ext/psych/lib/psych/visitors/yaml_tree.rb: ScalarScanner can be passed to the YAMLTree visitor.
-rw-r--r--CHANGELOG.rdoc7
-rw-r--r--lib/psych/visitors/to_ruby.rb6
-rw-r--r--lib/psych/visitors/yaml_tree.rb4
3 files changed, 12 insertions, 5 deletions
diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc
index b7b4aad..9730b5b 100644
--- a/CHANGELOG.rdoc
+++ b/CHANGELOG.rdoc
@@ -1,3 +1,10 @@
+Tue Oct 4 05:59:24 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: ToRuby visitor can be
+ constructed with a ScalarScanner.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: ScalarScanner can be
+ passed to the YAMLTree visitor.
+
Tue Oct 4 05:47:23 2011 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/visitors/to_ruby.rb: Define Regexp::NOENCODING
diff --git a/lib/psych/visitors/to_ruby.rb b/lib/psych/visitors/to_ruby.rb
index b76cd7d..5cef198 100644
--- a/lib/psych/visitors/to_ruby.rb
+++ b/lib/psych/visitors/to_ruby.rb
@@ -9,10 +9,10 @@ module Psych
###
# This class walks a YAML AST, converting each node to ruby
class ToRuby < Psych::Visitors::Visitor
- def initialize
- super
+ def initialize ss = ScalarScanner.new
+ super()
@st = {}
- @ss = ScalarScanner.new
+ @ss = ss
@domain_types = Psych.domain_types
end
diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb
index 1f1acdb..5a09285 100644
--- a/lib/psych/visitors/yaml_tree.rb
+++ b/lib/psych/visitors/yaml_tree.rb
@@ -12,13 +12,13 @@ module Psych
alias :finished? :finished
alias :started? :started
- def initialize options = {}, emitter = Psych::TreeBuilder.new
+ def initialize options = {}, emitter = TreeBuilder.new, ss = ScalarScanner.new
super()
@started = false
@finished = false
@emitter = emitter
@st = {}
- @ss = ScalarScanner.new
+ @ss = ss
@options = options
@dispatch_cache = Hash.new do |h,klass|