Class: Psych::Visitors::JSONTree

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

Instance Attribute Summary

Attributes inherited from Visitor

#finished, #started

Instance Method Summary collapse

Methods inherited from YAMLTree

#accept, #finish, #push, #start, #tree, #visit_Array, #visit_Class, #visit_Complex, #visit_DateTime, #visit_Exception, #visit_Float, #visit_Hash, #visit_Integer, #visit_NilClass, #visit_Object, #visit_Psych_Omap, #visit_Psych_Set, #visit_Range, #visit_Rational, #visit_Regexp, #visit_Struct, #visit_Time

Methods inherited from Visitor

#accept

Constructor Details

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

Returns a new instance of JSONTree.



4
5
6
# File 'lib/psych/visitors/json_tree.rb', line 4

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

Instance Method Details

#visit_String(o) ⇒ Object Also known as: visit_Symbol



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

def visit_String o
  @emitter.scalar o.to_s, nil, nil, false, true, Nodes::Scalar::ANY
end