Class: RKit::Parser::Base

Inherits:
Object show all
Defined in:
lib/r_kit/parser/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(md_path, frame:) ⇒ Base

Returns a new instance of Base.



9
10
11
12
# File 'lib/r_kit/parser/base.rb', line 9

def initialize md_path, frame:;
  @raw = File.open(md_path).read
  @frame = frame
end

Instance Attribute Details

#frameObject

Returns the value of attribute frame.



7
8
9
# File 'lib/r_kit/parser/base.rb', line 7

def frame
  @frame
end

#rawObject

Returns the value of attribute raw.



7
8
9
# File 'lib/r_kit/parser/base.rb', line 7

def raw
  @raw
end

Class Method Details

.parse(md_path, frame:) ⇒ Object



3
4
5
# File 'lib/r_kit/parser/base.rb', line 3

def self.parse md_path, frame:;
  new(md_path, frame: frame).parse
end

Instance Method Details

#parseObject



15
16
17
# File 'lib/r_kit/parser/base.rb', line 15

def parse
  RKit::Parser::Tree.new(raw, tag: :document, frame: frame).parsed
end