Class: Psych::SimpleHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/psych/simple.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



11
12
13
# File 'lib/psych/simple.rb', line 11

def document
  @document
end

Instance Method Details

#alias(anchor) ⇒ Object



55
56
57
# File 'lib/psych/simple.rb', line 55

def alias(anchor)
  raise
end

#emptyObject



59
60
61
# File 'lib/psych/simple.rb', line 59

def empty
  raise
end

#end_document(implicit) ⇒ Object



26
27
28
# File 'lib/psych/simple.rb', line 26

def end_document(implicit)
  @document = @stack.pop.last
end

#end_mappingObject



35
36
37
38
# File 'lib/psych/simple.rb', line 35

def end_mapping
  mapping = Hash[*@stack.pop]
  @stack.last << mapping
end

#end_sequenceObject



45
46
47
48
# File 'lib/psych/simple.rb', line 45

def end_sequence
  sequence = @stack.pop
  @stack.last << sequence
end

#end_streamObject



17
18
19
# File 'lib/psych/simple.rb', line 17

def end_stream
  raise unless @stack.empty?
end

#scalar(value, anchor, tag, plain, quoted, style) ⇒ Object



50
51
52
53
# File 'lib/psych/simple.rb', line 50

def scalar(value, anchor, tag, plain, quoted, style)
  raise if anchor or tag
  @stack.last << value
end

#start_document(version, tag_directives, implicit) ⇒ Object



21
22
23
24
# File 'lib/psych/simple.rb', line 21

def start_document version, tag_directives, implicit
  raise unless tag_directives.empty?
  @stack.push Array.new
end

#start_mapping(anchor, tag, implicit, style) ⇒ Object



30
31
32
33
# File 'lib/psych/simple.rb', line 30

def start_mapping(anchor, tag, implicit, style)
  raise if anchor or tag
  @stack.push(Array.new)
end

#start_sequence(anchor, tag, implicit, style) ⇒ Object



40
41
42
43
# File 'lib/psych/simple.rb', line 40

def start_sequence(anchor, tag, implicit, style)
  raise if anchor or tag
  @stack.push(Array.new)
end

#start_stream(encoding) ⇒ Object



13
14
15
# File 'lib/psych/simple.rb', line 13

def start_stream(encoding)
  @stack = Array.new
end