lib/exec_if.rb in exec_if-0.2.0 vs lib/exec_if.rb in exec_if-0.3.0
- old
+ new
@@ -1,17 +1,15 @@
-require "exec_if/version"
-
class Object
def exec_if(obj, &blk)
case obj
when Proc
- obj.call(self) ? blk.call(self, obj) : self
+ obj.call(self) ? instance_exec(obj, &blk) : self
when Symbol
- public_send(obj) ? blk.call(self, obj) : self
+ public_send(obj) ? instance_exec(obj, &blk) : self
when String
- eval(obj) ? blk.call(self, obj) : self
+ instance_eval(obj) ? instance_exec(obj, &blk) : self
when Object
- obj ? blk.call(self, obj) : self
+ obj ? instance_exec(obj, &blk) : self
when nil, false
self
end
end
end