Class: LaTeXProjectTemplate::Component
- Inherits:
-
Object
- Object
- LaTeXProjectTemplate::Component
- Defined in:
- lib/latex_project_template.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #evaluate(erb_obj) ⇒ Object
-
#initialize(path) ⇒ Component
constructor
A new instance of Component.
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
#path ⇒ Object (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 |