Class: Geoffrey::Template
- Inherits:
-
Object
- Object
- Geoffrey::Template
- Includes:
- FileHelper
- Defined in:
- lib/geoffrey/template.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#package ⇒ Object
Returns the value of attribute package.
Instance Method Summary collapse
-
#initialize(file) ⇒ Template
constructor
A new instance of Template.
Methods included from FileHelper
#extract_filename, #remove_extension
Constructor Details
#initialize(file) ⇒ Template
Returns a new instance of Template.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/geoffrey/template.rb', line 13 def initialize(file) @file = file @package = Geoffrey::Package.new set_name_from_file case File.extname(file) when '.rb' package.instance_eval open(file).read when '.json' load_attributes_from_json end end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
11 12 13 |
# File 'lib/geoffrey/template.rb', line 11 def file @file end |
#package ⇒ Object
Returns the value of attribute package.
11 12 13 |
# File 'lib/geoffrey/template.rb', line 11 def package @package end |