class Undies::RootNode
Attributes
cached[R]
RootNode
is specifically used to handle root document markup.
io[R]
RootNode
is specifically used to handle root document markup.
Public Class Methods
new(io)
click to toggle source
# File lib/undies/root_node.rb, line 17 def initialize(io) @io = io @cached = nil end
Public Instance Methods
attrs(*args)
click to toggle source
# File lib/undies/root_node.rb, line 22 def attrs(*args) raise RootAPIError, "can't call '__attrs' at the root node level" end
element_node(element_node)
click to toggle source
# File lib/undies/root_node.rb, line 31 def element_node(element_node) write_cached @cached = element_node end
flush()
click to toggle source
# File lib/undies/root_node.rb, line 40 def flush write_cached @cached = nil self end
partial(partial)
click to toggle source
# File lib/undies/root_node.rb, line 36 def partial(partial) text(partial) end
pop()
click to toggle source
# File lib/undies/root_node.rb, line 51 def pop flush end
push()
click to toggle source
# File lib/undies/root_node.rb, line 46 def push @io.push(@cached) @cached = nil end
text(raw)
click to toggle source
# File lib/undies/root_node.rb, line 26 def text(raw) write_cached @cached = "#{@io.line_indent}#{raw.to_s}#{@io.newline}" end
Private Instance Methods
write_cached()
click to toggle source
# File lib/undies/root_node.rb, line 57 def write_cached @io << @cached.to_s end