lib/eco-rake/default/const.rb in eco-rake-0.2.6 vs lib/eco-rake/default/const.rb in eco-rake-0.2.7
- old
+ new
@@ -1,11 +1,11 @@
class EcoRake
module Default
module Const
class << self
def included(base)
- super(base)
+ super
base.extend EcoRake::Base::SymbolResolver
base.extend ClassMethods
end
end
@@ -25,13 +25,15 @@
raise ArgumentError, "#{msg} (class method)" if methods.include?(attr)
raise ArgumentError, "#{msg} (instance method)" if instance_methods.include?(attr)
end
define_singleton_method attr do
- msg = "Missing const '#{attr.to_s.upcase}' in #{self}"
value = resolve_const(attr)
- value = default if value.nil? && default != :not_used
+ value = default if value.nil? && default != :not_used
+
+ msg = "Missing const '#{attr.to_s.upcase}' in #{self}"
raise NameError, msg if value.nil? && required
+
yield(value) if block_given?
value
end
define_method attr do |&block|