Sha256: 3592b17e34e0f97786f7dfce205756712fe06b5de132298d48d71d7bc00d0ee3

Contents?: true

Size: 883 Bytes

Versions: 40

Compression:

Stored size: 883 Bytes

Contents

major, minor, patch = RUBY_VERSION.split('.').map{ |v| v.to_i }
if major <= 1 && minor <= 8

    class Object
        module InstanceExecHelper; end
        include InstanceExecHelper
        def instance_exec(*args, &block)
            begin
                old_critical, Thread.critical = Thread.critical, true
                n = 0
                n += 1 while respond_to?(mname="__instance_exec#{n}")
                InstanceExecHelper.module_eval{ define_method(mname, &block) }
            ensure
                Thread.critical = old_critical
            end
            begin
                ret = send(mname, *args)
            ensure
                InstanceExecHelper.module_eval{ remove_method(mname) } rescue nil
            end
            ret
        end
    end
    
end

class Object
    
    def blank?
        respond_to?(:empty?) ? empty? : !self
    end
    
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
spiderfw-0.6.32 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.31 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.30 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.29 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.28 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.27 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.26 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.26.pre1 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.25 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.24 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.23 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.22 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.21 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.20 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.19 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.18 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.17 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.16 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.15 lib/spiderfw/utils/monkey/object.rb
spiderfw-0.6.14 lib/spiderfw/utils/monkey/object.rb