Sha256: 6162077d3d9e6d1e66564acb118c0cacdc2311384e8c42756493c20918ea3dcd

Contents?: true

Size: 497 Bytes

Versions: 1

Compression:

Stored size: 497 Bytes

Contents

#
# short inspect method on all objects.
#
# "abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop".insp
#    -> "abcdefghijklmnopabcdefghijk..."
# Model.find(1).insp 
#    -> "<Model#1>"

module Object::InMethod
  def in?(collection)
    collection.include?(self)
  end
end

class Object
  include InMethod
end

module Object::InMethod::Etest
  def test_in
    assert_equal true, "1".in?(%w(1 2 3))
    assert_equal false, 1.in?(%w(1 2 3))
    assert_equal false, 1.in?([])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vex-0.4.2 lib/vex/base/object/in.rb