lib/bonsai/template.rb in bonsai-1.1.4 vs lib/bonsai/template.rb in bonsai-1.1.5
- old
+ new
@@ -1,16 +1,15 @@
module Bonsai
- class Template
- @@path = "templates"
-
+ class Template
class NotFound < StandardError; end
+ # Class methods
class << self
- def path; @@path; end
-
- def path=(path)
- @@path = path
+ attr_accessor :path
+
+ def path
+ @path || "templates"
end
def find(name)
disk_path = Dir["#{path}/#{name}.*"]
@@ -20,9 +19,10 @@
raise NotFound, "template '#{name}' not found at #{path}"
end
end
end
+ # Instance methods
attr_reader :path
def initialize(path)
@path = path
end
\ No newline at end of file