Class: Rmsgen::Titleizer

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

Constant Summary collapse

TEMPLATE =
File.join(File.dirname(__FILE__), '..', 'templates', 'title.erb')

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(polnote, options = {}) ⇒ Titleizer

Returns a new instance of Titleizer.


7
8
9
10
11
12
13
# File 'lib/rmsgen/titleizer.rb', line 7

def initialize(polnote, options={})
  @body = polnote.body
  @title = options[:title]

  @script = Script.new($stdout)
  run!
end

Instance Attribute Details

#titleObject (readonly)

Returns the value of attribute title.


5
6
7
# File 'lib/rmsgen/titleizer.rb', line 5

def title
  @title
end

Instance Method Details

#bodyObject


15
16
17
# File 'lib/rmsgen/titleizer.rb', line 15

def body
  ERB.new(File.read(TEMPLATE)).result(binding)
end

#title_underscoreObject


27
28
29
# File 'lib/rmsgen/titleizer.rb', line 27

def title_underscore
  @title.gsub(' ', '_')
end

#to_htmlObject


31
32
33
# File 'lib/rmsgen/titleizer.rb', line 31

def to_html
  body
end

#today_formatObject


19
20
21
# File 'lib/rmsgen/titleizer.rb', line 19

def today_format
  Date.today.strftime('%d %B %Y')
end

#today_underscoreObject


23
24
25
# File 'lib/rmsgen/titleizer.rb', line 23

def today_underscore
  today_format.gsub(' ', '_')
end