Class: HTMLLayout

Inherits:
Object show all
Defined in:
lib/review/htmllayout.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(src, title, template) ⇒ HTMLLayout

Returns a new instance of HTMLLayout.



5
6
7
8
9
# File 'lib/review/htmllayout.rb', line 5

def initialize(src, title, template)
  @body = src
  @title = title
  @template = template
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



10
11
12
# File 'lib/review/htmllayout.rb', line 10

def body
  @body
end

#titleObject (readonly)

Returns the value of attribute title.



10
11
12
# File 'lib/review/htmllayout.rb', line 10

def title
  @title
end

Instance Method Details

#resultObject



12
13
14
15
16
17
18
# File 'lib/review/htmllayout.rb', line 12

def result
  if File.exist?(@template)
    return ERB.new(IO.read(@template)).result(binding)
  else
    return @src
  end
end