123456789_123456789_123456789_123456789_123456789_

Class: Gem::NoAliasYAMLTree

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Psych::Visitors::YAMLTree
Instance Chain:
self, Psych::Visitors::YAMLTree
Inherits: Psych::Visitors::YAMLTree
  • Object
Defined in: lib/rubygems/psych_tree.rb

Class Method Summary

Instance Method Summary

Class Method Details

.create

[ GitHub ]

  
# File 'lib/rubygems/psych_tree.rb', line 6

def self.create
  new({})
end

Instance Method Details

#format_time(time) (private)

This is ported over from the yaml_tree in 1.9.3

[ GitHub ]

  
# File 'lib/rubygems/psych_tree.rb', line 26

def format_time(time)
  if time.utc?
    time.strftime("%Y-%m-%d %H:%M:%S.%9N Z")
  else
    time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")
  end
end

#register(target, obj)

Noop this out so there are no anchors

[ GitHub ]

  
# File 'lib/rubygems/psych_tree.rb', line 22

def register(target, obj)
end

#visit_Hash(o)

[ GitHub ]

  
# File 'lib/rubygems/psych_tree.rb', line 17

def visit_Hash(o)
  super(o.compact)
end

#visit_String(str)

[ GitHub ]

  
# File 'lib/rubygems/psych_tree.rb', line 10

def visit_String(str)
  return super unless str == "=" # or whatever you want

  quote = Psych::Nodes::Scalar::SINGLE_QUOTED
  @emitter.scalar str, nil, nil, false, true, quote
end