Class: Psych::Visitors::JSONTree

Inherits:
YAMLTree show all
Includes:
JSON::RubyEvents
Defined in:
lib/psych/visitors/json_tree.rb

Direct Known Subclasses

JSON::Stream

Instance Attribute Summary

Attributes inherited from YAMLTree

#finished, #started

Instance Method Summary collapse

Methods included from JSON::RubyEvents

#visit_DateTime, #visit_String, #visit_Time

Methods inherited from YAMLTree

#finish, #format_time, #push, #start, #tree, #visit_Array, #visit_BigDecimal, #visit_Class, #visit_Complex, #visit_DateTime, #visit_Exception, #visit_Float, #visit_Hash, #visit_Integer, #visit_Module, #visit_NilClass, #visit_Object, #visit_Psych_Omap, #visit_Psych_Set, #visit_Range, #visit_Rational, #visit_Regexp, #visit_String, #visit_Struct, #visit_Symbol, #visit_Time

Constructor Details

#initialize(options = {}, emitter = Psych::JSON::TreeBuilder.new) ⇒ JSONTree

Returns a new instance of JSONTree.



8
9
10
# File 'lib/psych/visitors/json_tree.rb', line 8

def initialize options = {}, emitter = Psych::JSON::TreeBuilder.new
  super
end

Instance Method Details

#accept(target) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/psych/visitors/json_tree.rb', line 12

def accept target
  if target.respond_to?(:encode_with)
    dump_coder target
  else
    send(@dispatch_cache[target.class], target)
  end
end