Class: RTFDoc::Template

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nodes, config) ⇒ Template

Returns a new instance of Template.



134
135
136
137
138
139
140
141
# File 'lib/rtfdoc.rb', line 134

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

  generate_grouped_menu_content(nodes)
end

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



132
133
134
# File 'lib/rtfdoc.rb', line 132

def app_name
  @app_name
end

#page_titleObject (readonly)

Returns the value of attribute page_title.



132
133
134
# File 'lib/rtfdoc.rb', line 132

def page_title
  @page_title
end

Instance Method Details

#outputObject



143
144
145
146
# File 'lib/rtfdoc.rb', line 143

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