class Alchemy::UserManual::Creator

Attributes

name[RW]

Public Class Methods

new(name = Rails.application.class.parent_name) click to toggle source
# File lib/alchemy/user_manual/creator.rb, line 11
def initialize(name = Rails.application.class.parent_name)
  self.name = name
  @manual = self
end

Public Instance Methods

html_content() click to toggle source
# File lib/alchemy/user_manual/creator.rb, line 16
def html_content
  @content ||= GitHub::Markdown.render_gfm(render_content)
end

Private Instance Methods

ordered_template_files() click to toggle source
# File lib/alchemy/user_manual/creator.rb, line 26
def ordered_template_files
  Dir[
    "#{template_path}/introduction.md.erb",
    "#{template_path}/page_layouts.md.erb",
    "#{template_path}/elements.md.erb"
  ]
end
render_content() click to toggle source
# File lib/alchemy/user_manual/creator.rb, line 34
def render_content
  render_result = ""
  ordered_template_files.each do |template|
    render_result << ERB.new(File.read(template)).result(binding)
  end
  render_result
end
template_path() click to toggle source
# File lib/alchemy/user_manual/creator.rb, line 22
def template_path
  File.expand_path("../templates", __FILE__)
end