class Psych::Inherit::File::Handler

Constants

NODE_NAME
TAG_NAME

Attributes

reader[R]

Public Class Methods

new(reader) click to toggle source
Calls superclass method
# File lib/psych/inherit/file/handler.rb, line 12
def initialize(reader)
  @reader = reader
  super()
end

Public Instance Methods

document() click to toggle source
# File lib/psych/inherit/file/handler.rb, line 17
def document
  root.children.first
end
include_node?(node) click to toggle source
# File lib/psych/inherit/file/handler.rb, line 25
def include_node?(node)
  node.respond_to?(:value) && node.value == NODE_NAME
end
last_node() click to toggle source
# File lib/psych/inherit/file/handler.rb, line 21
def last_node
  @last.children.last
end
scalar(value, anchor, tag, plain, quoted, style) click to toggle source
Calls superclass method
# File lib/psych/inherit/file/handler.rb, line 29
def scalar(value, anchor, tag, plain, quoted, style)
  if tag == TAG_NAME && include_node?(last_node)
    pop_previous_node

    nodes = @stack.last.children
    content = reader.parse_file(value).children.first
    nodes << content
    push content
  else
    super
  end
end

Private Instance Methods

pop_previous_node() click to toggle source
# File lib/psych/inherit/file/handler.rb, line 44
def pop_previous_node
  @stack.pop
  @stack.last.children.pop
end