Method: Psych::Visitors::YAMLTree#push

Defined in:
lib/psych/visitors/yaml_tree.rb

#push(object) ⇒ Object Also known as: <<



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/psych/visitors/yaml_tree.rb', line 103

def push object
  start unless started?
  version = []
  version = [1,1] if @options[:header]

  case @options[:version]
  when Array
    version = @options[:version]
  when String
    version = @options[:version].split('.').map { |x| x.to_i }
  else
    version = [1,1]
  end if @options.key? :version

  @emitter.start_document version, [], false
  accept object
  @emitter.end_document !@emitter.streaming?
end