Class: RTFDoc::Template

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sections, config) ⇒ Template

Returns a new instance of Template.



116
117
118
119
120
121
# File 'lib/rtfdoc.rb', line 116

def initialize(sections, config)
  @content      = sections.map(&:output).join
  @menu_content = sections.map(&:menu_output).join
  @app_name     = config['app_name']
  @page_title   = config['title']
end

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



114
115
116
# File 'lib/rtfdoc.rb', line 114

def app_name
  @app_name
end

#page_titleObject (readonly)

Returns the value of attribute page_title.



114
115
116
# File 'lib/rtfdoc.rb', line 114

def page_title
  @page_title
end

Instance Method Details

#outputObject



123
124
125
126
# File 'lib/rtfdoc.rb', line 123

def output
  template = Erubi::Engine.new(File.read(File.expand_path('../src/index.html.erb', __dir__)))
  eval(template.src)
end