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
16
# File 'lib/guide-em-up/guide.rb', line 10

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

Instance Attribute Details

#directoryObject

Returns the value of attribute directory

Returns:

  • (Object)

    the current value of directory



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

def directory
  @directory
end

#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



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

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