Class: Vedeu::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/support/template.rb

Overview

Generic class to loading a template and parsing it via ERb.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, path) ⇒ Template

Parameters:

  • object (Class)
  • path (String)


19
20
21
# File 'lib/vedeu/support/template.rb', line 19

def initialize(object, path)
  @object, @path = object, path
end

Instance Attribute Details

#objectObject (readonly, private)

Returns the value of attribute object.



30
31
32
# File 'lib/vedeu/support/template.rb', line 30

def object
  @object
end

#pathObject (readonly, private)

Returns the value of attribute path.



30
31
32
# File 'lib/vedeu/support/template.rb', line 30

def path
  @path
end

Class Method Details

.parse(object, path) ⇒ void

This method returns an undefined value.

Parameters:

  • object (Class)
  • path (String)


12
13
14
# File 'lib/vedeu/support/template.rb', line 12

def self.parse(object, path)
  new(object, path).parse
end

Instance Method Details

#loadString (private)

Returns:

  • (String)


33
34
35
# File 'lib/vedeu/support/template.rb', line 33

def load
  File.read(path)
end

#parsevoid

This method returns an undefined value.



24
25
26
# File 'lib/vedeu/support/template.rb', line 24

def parse
  ERB.new(load, nil, '-').result(binding)
end