Class: LaTeXProjectTemplate::Component

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Component

Returns a new instance of Component.



88
89
90
# File 'lib/latex_project_template.rb', line 88

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



86
87
88
# File 'lib/latex_project_template.rb', line 86

def path
  @path
end

Instance Method Details

#evaluate(erb_obj) ⇒ Object



92
93
94
95
96
97
98
99
100
101
# File 'lib/latex_project_template.rb', line 92

def evaluate(erb_obj)
  if /\.erb$/ =~ @path
    erb_obj.instance_exec(@path) do |path|
      erb = ERB.new(File.read(path))
      erb.result(binding)
    end
  else
    File.read(@path)
  end
end