Class: Eprayim::Doc

Inherits:
Object
  • Object
show all
Defined in:
lib/eprayim.rb,
lib/eprayim/render/html.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Doc

Returns a new instance of Doc.



15
16
17
18
19
# File 'lib/eprayim.rb', line 15

def initialize(input)
  @input = input
  @input = StringIO.new(input) if input.is_a? String
  @parser = Parser.new(@input)
end

Instance Attribute Details

#inputObject (readonly)

the origin text before parse



12
13
14
# File 'lib/eprayim.rb', line 12

def input
  @input
end

#parserObject (readonly)

Returns the value of attribute parser.



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

def parser
  @parser
end

Instance Method Details

#anchorObject



25
26
27
# File 'lib/eprayim.rb', line 25

def anchor
  @anchor ||= @parser.peek_head[1]
end

#titleObject



21
22
23
# File 'lib/eprayim.rb', line 21

def title
  @title ||= @parser.peek_head[0]
end

#to_htmlObject



36
37
38
# File 'lib/eprayim/render/html.rb', line 36

def to_html
  @html ||= parser.parse().to_html
end