Class: GuideEmUp::Guide

Inherits:
Struct
  • Object
show all
Defined in:
lib/guide-em-up/guide.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, template) ⇒ Guide

Returns a new instance of Guide.



10
11
12
13
14
15
# File 'lib/guide-em-up/guide.rb', line 10

def initialize(filename, template)
  self.filename = filename
  self.title    = File.basename(filename)
  self.template = template
  @codemap = {}
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename

Returns:

  • (Object)

    the current value of filename



9
10
11
# File 'lib/guide-em-up/guide.rb', line 9

def filename
  @filename
end

#templateObject

Returns the value of attribute template

Returns:

  • (Object)

    the current value of template



9
10
11
# File 'lib/guide-em-up/guide.rb', line 9

def template
  @template
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



9
10
11
# File 'lib/guide-em-up/guide.rb', line 9

def title
  @title
end

Instance Method Details

#htmlObject



17
18
19
20
# File 'lib/guide-em-up/guide.rb', line 17

def html
  tmpl = File.read(template)
  Erubis::Eruby.new(tmpl).result(to_hash)
end