summaryrefslogtreecommitdiff
path: root/ruby_1_9_3/ext/psych/lib/psych/visitors/json_tree.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ruby_1_9_3/ext/psych/lib/psych/visitors/json_tree.rb')
-rw-r--r--ruby_1_9_3/ext/psych/lib/psych/visitors/json_tree.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/ruby_1_9_3/ext/psych/lib/psych/visitors/json_tree.rb b/ruby_1_9_3/ext/psych/lib/psych/visitors/json_tree.rb
new file mode 100644
index 0000000000..0350dd1faa
--- /dev/null
+++ b/ruby_1_9_3/ext/psych/lib/psych/visitors/json_tree.rb
@@ -0,0 +1,21 @@
+require 'psych/json/ruby_events'
+
+module Psych
+ module Visitors
+ class JSONTree < YAMLTree
+ include Psych::JSON::RubyEvents
+
+ def initialize options = {}, emitter = Psych::JSON::TreeBuilder.new
+ super
+ end
+
+ def accept target
+ if target.respond_to?(:encode_with)
+ dump_coder target
+ else
+ send(@dispatch_cache[target.class], target)
+ end
+ end
+ end
+ end
+end