Class: GoogleYAMLTree
- Inherits:
-
Psych::Visitors::YAMLTree
- Object
- Psych::Visitors::YAMLTree
- GoogleYAMLTree
- Defined in:
- lib/google-yaml.rb
Overview
Google App Engine doesn’t support achors and alias feature of YAML Psych doesn’t provide an option to disable achors/alias YAML features
HACK: subclass the native YAMLTree, and bypass logic which checks for aliases ../psych/vistors/yaml_tree.rb
Instance Method Summary collapse
Instance Method Details
#accept(target) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/google-yaml.rb', line 7 def accept target # HACK: disabled alias lookup # return any aliases we find # if @st.key? target # oid = @st.id_for target # node = @st.node_for target # anchor = oid.to_s # node.anchor = anchor # return @emitter.alias anchor # end if target.respond_to?(:to_yaml) begin loc = target.method(:to_yaml).source_location.first if loc !~ /(syck\/rubytypes.rb|psych\/core_ext.rb)/ unless target.respond_to?(:encode_with) if $VERBOSE warn "implementing to_yaml is deprecated, please implement \"encode_with\"" end target.to_yaml(:nodump => true) end end rescue # public_method or source_location might be overridden, # and it's OK to skip it since it's only to emit a warning end end if target.respond_to?(:encode_with) dump_coder target else send(@dispatch_cache[target.class], target) end end |