Class: Template
- Inherits:
-
Object
- Object
- Template
- Defined in:
- lib/template.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
Returns the value of attribute contents.
-
#file_path ⇒ Object
Returns the value of attribute file_path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file_path) ⇒ Template
constructor
A new instance of Template.
- #variables ⇒ Object
Constructor Details
#initialize(file_path) ⇒ Template
Returns a new instance of Template.
12 13 14 15 |
# File 'lib/template.rb', line 12 def initialize(file_path) @file_path = file_path @contents = File.open(@file_path, "rb").read end |
Instance Attribute Details
#contents ⇒ Object
Returns the value of attribute contents.
6 7 8 |
# File 'lib/template.rb', line 6 def contents @contents end |
#file_path ⇒ Object
Returns the value of attribute file_path.
6 7 8 |
# File 'lib/template.rb', line 6 def file_path @file_path end |
Class Method Details
Instance Method Details
#variables ⇒ Object
17 18 19 |
# File 'lib/template.rb', line 17 def variables self.contents.scan(/(\@[a-z]+[0-9a-z_]*)/i).uniq end |