Sha256: 2b7651c43ff1e5eb3426d36d4ac4ed6915c2a77b64d310fe1f3581ddb7bb8232

Contents?: true

Size: 505 Bytes

Versions: 6

Compression:

Stored size: 505 Bytes

Contents

# encoding: utf-8

module Rubymisc
  module Object
    def in?(collection)
      collection.respond_to?(:include?) ? collection.include?(self) : false
    end

    def not
      not_functor = lambda { |op, *a, &b| !self.__send__(op, *a, &b) }

      not_functor.singleton_class.module_eval <<-CODE
        def method_missing(method, *arguments, &block)
          call(method, *arguments, &block)
        end
      CODE

      not_functor
    end
  end
end

::Object.module_eval 'include Rubymisc::Object'

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubymisc-0.0.3.3 lib/rubymisc/ext/object.rb
rubymisc-0.0.3.2 lib/rubymisc/ext/object.rb
rubymisc-0.0.3.1 lib/rubymisc/ext/object.rb
rubymisc-0.0.3 lib/rubymisc/ext/object.rb
rubymisc-0.0.2 lib/rubymisc/ext/object.rb
rubymisc-0.0.1 lib/rubymisc/ext/object.rb