lib/surrounded.rb in surrounded-0.9.4 vs lib/surrounded.rb in surrounded-0.9.5

- old
+ new

@@ -1,7 +1,8 @@ require "surrounded/version" require "surrounded/context" +require "singleton" # This module should be added to objects which will enter # into context objects. # # Its main purpose is to keep a reference to the context @@ -26,11 +27,11 @@ def surroundings @__surroundings__ ||= [] end def context - surroundings.first || NullContext.new + surroundings.first || NullContext.instance end def method_missing(meth, *args, &block) context.role?(meth){} || super end @@ -38,9 +39,10 @@ def respond_to_missing?(meth, include_private=false) !!context.role?(meth){} || super end class NullContext + include Singleton def role?(*args) nil end end end