Sha256: d708e321f9a84c5e014ca5b2f5b74c059ef8ee5581d180beaff3742c2398b009

Contents?: true

Size: 382 Bytes

Versions: 23

Compression:

Stored size: 382 Bytes

Contents

# http://blog.jayfields.com/2007/08/ruby-adding-not-method-for-readability.html
class Object
  define_method :not do
    Not.new(self)
  end
  class Not
    private *instance_methods.select { |m| m !~ /(^__|^\W|^binding$)/ }
    def initialize(subject)
      @subject = subject
    end
    def method_missing(sym, *args, &blk)
      !@subject.send(sym,*args,&blk)
    end
  end
end

Version data entries

23 entries across 23 versions & 7 rubygems

Version Path
FreedomCoder-utility_belt-1.1.1.2 lib/utility_belt/not.rb
FreedomCoder-utility_belt-1.1.1 lib/utility_belt/not.rb
akitaonrails-utility_belt-1.0.10 lib/utility_belt/not.rb
akitaonrails-utility_belt-1.0.11 lib/utility_belt/not.rb
akitaonrails-utility_belt-1.0.12 lib/utility_belt/not.rb
mguterl-utility_belt-1.0.7 lib/utility_belt/not.rb
rwilcox-utility_belt-1.0.7 lib/utility_belt/not.rb
rwilcox-utility_belt-1.0.9 lib/utility_belt/not.rb
timocratic-utility_belt-1.0.7.1 lib/utility_belt/not.rb
timocratic-utility_belt-1.0.7.2 lib/utility_belt/not.rb
timocratic-utility_belt-1.0.7.3 lib/utility_belt/not.rb
flyrb-1.0.0.c lib/flyrb/not.rb
flyrb-1.0.0.b lib/flyrb/not.rb
flyrb-1.0.0.a lib/flyrb/not.rb
akitaonrails-utility_belt-1.0.13 lib/utility_belt/not.rb
utility_belt-1.0.3 lib/not.rb
utility_belt-1.0.0 lib/not.rb
utility_belt-1.0.6 lib/not.rb
utility_belt-1.0.2 lib/not.rb
utility_belt-1.0.5 lib/not.rb