lib/conifer.rb in conifer-0.2.1 vs lib/conifer.rb in conifer-0.3.0
- old
+ new
@@ -8,13 +8,14 @@
module Conifer
extend ActiveSupport::Concern
class_methods do
def conifer(file, prefix: nil, dir: nil, method: ::File.basename(file.to_s, '.yml'), singleton: false)
+ directory = dir || ::File.expand_path(::File.dirname(caller_locations.first.path))
+
body = proc do
return instance_variable_get("@conifer_#{method}") if instance_variable_defined?("@conifer_#{method}")
- directory = dir || ::File.expand_path(::File.dirname(caller_locations.first.path))
instance_variable_set "@conifer_#{method}", Conifer::File.new(file, prefix: prefix, dir: directory)
end
if singleton
define_singleton_method method, &body