Sha256: d3336d351eaee535cc70e60a40a9e31c54ea12ece45706fc11641946183b4984

Contents?: true

Size: 512 Bytes

Versions: 57

Compression:

Stored size: 512 Bytes

Contents

class Object
  # Returns true if this object is included in the argument. Argument must be
  # any object which responds to +#include?+. Usage:
  #
  #   characters = ["Konata", "Kagami", "Tsukasa"]
  #   "Konata".in?(characters) # => true
  #
  # This will throw an ArgumentError if the argument doesn't respond
  # to +#include?+.
  def in?(another_object)
    another_object.include?(self)
  rescue NoMethodError
    raise ArgumentError.new("The parameter passed to #in? must respond to #include?")
  end
end

Version data entries

57 entries across 57 versions & 2 rubygems

Version Path
activesupport-4.1.0.beta2 lib/active_support/core_ext/object/inclusion.rb
activesupport-4.1.0.beta1 lib/active_support/core_ext/object/inclusion.rb
activesupport-3.1.12 lib/active_support/core_ext/object/inclusion.rb
activesupport-3.1.11 lib/active_support/core_ext/object/inclusion.rb
activesupport-3.1.10 lib/active_support/core_ext/object/inclusion.rb
activesupport-3.1.9 lib/active_support/core_ext/object/inclusion.rb
dirty_history-0.7.3 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/object/inclusion.rb
dirty_history-0.7.2 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/object/inclusion.rb
dirty_history-0.7.1 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/object/inclusion.rb
dirty_history-0.7.0 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/object/inclusion.rb
dirty_history-0.6.7 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/object/inclusion.rb
dirty_history-0.6.6 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/object/inclusion.rb
dirty_history-0.6.5 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/object/inclusion.rb
dirty_history-0.6.4 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/object/inclusion.rb
activesupport-3.1.8 lib/active_support/core_ext/object/inclusion.rb
dirty_history-0.6.3 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/object/inclusion.rb
activesupport-3.1.7 lib/active_support/core_ext/object/inclusion.rb
dirty_history-0.6.2 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/object/inclusion.rb
dirty_history-0.6.1 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/object/inclusion.rb
dirty_history-0.6.0 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/object/inclusion.rb