class Object

Public Instance Methods

exec_if(obj, &blk) click to toggle source
# File lib/exec_if.rb, line 2
def exec_if(obj, &blk)
  case obj
  when Proc
    obj.call(self) ? instance_exec(obj, &blk) : self
  when Symbol
    public_send(obj) ? instance_exec(obj, &blk) : self
  when String
    instance_eval(obj) ? instance_exec(obj, &blk) : self
  when Object
    obj ? instance_exec(obj, &blk) : self
  when nil, false
    self
  end
end