Class: Leandocument::Render

Inherits:
Object
  • Object
show all
Defined in:
lib/leandocument/render.rb

Direct Known Subclasses

Markdown, ReStructuredText

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Render

Returns a new instance of Render.



4
5
6
7
8
# File 'lib/leandocument/render.rb', line 4

def initialize(options = {})
  self.content = options[:content]
  self.indent  = options[:indent]
  self.path    = options[:path]
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



3
4
5
# File 'lib/leandocument/render.rb', line 3

def content
  @content
end

#indentObject

Returns the value of attribute indent.



3
4
5
# File 'lib/leandocument/render.rb', line 3

def indent
  @indent
end

#p_tocObject

Returns the value of attribute p_toc.



3
4
5
# File 'lib/leandocument/render.rb', line 3

def p_toc
  @p_toc
end

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/leandocument/render.rb', line 3

def path
  @path
end

Instance Method Details

#analyse_contentObject



10
11
12
# File 'lib/leandocument/render.rb', line 10

def analyse_content
  content = content_ary[1..-1].join("\n")
end

#content_aryObject



14
15
16
# File 'lib/leandocument/render.rb', line 14

def content_ary
  content.split(/\r\n|\r|\n/)
end

#titleObject



18
19
20
# File 'lib/leandocument/render.rb', line 18

def title
  content_ary[0]
end