Class: Bonsai::Template
- Inherits:
-
Object
- Object
- Bonsai::Template
- Defined in:
- lib/bonsai/template.rb
Defined Under Namespace
Classes: NotFound
Class Attribute Summary collapse
-
.path ⇒ Object
Returns the value of attribute path.
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Instance methods.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path) ⇒ Template
constructor
A new instance of Template.
Constructor Details
#initialize(path) ⇒ Template
Returns a new instance of Template.
27 28 29 |
# File 'lib/bonsai/template.rb', line 27 def initialize(path) @path = path end |
Class Attribute Details
.path ⇒ Object
Returns the value of attribute path.
7 8 9 |
# File 'lib/bonsai/template.rb', line 7 def path @path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Instance methods
25 26 27 |
# File 'lib/bonsai/template.rb', line 25 def path @path end |
Class Method Details
.find(name) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/bonsai/template.rb', line 13 def find(name) disk_path = Dir["#{path}/#{name}.*"] if disk_path.any? new disk_path.first else raise NotFound, "template '#{name}' not found at #{path}" end end |