class RKit::Parser::Tree

Attributes

frame[RW]
raw[RW]
tag[RW]

Public Class Methods

new(raw, tag: :document, frame:;) click to toggle source
# File lib/r_kit/parser/tree.rb, line 5
def initialize raw, tag: :document, frame:;
  @raw = raw
  @tag = tag

  @frame = frame
end

Public Instance Methods

branches() click to toggle source
# File lib/r_kit/parser/tree.rb, line 12
def branches
  raw.split(/\n{2,}/).map do |raw_block|
    RKit::Parser::Leaf.new(raw_block, frame: frame)
  end
end
parsed() click to toggle source
# File lib/r_kit/parser/tree.rb, line 18
def parsed
  branches.map(&:parsed).join("")
end