Class: Array

Inherits:
Object show all
Defined in:
lib/is_same/core_ext/array.rb,
lib/is_same/core_ext/backward_compliability/array.rb

Instance Method Summary collapse

Instance Method Details

#elements_matching(object = nil, &block) ⇒ Object

Return Array elements that are matching.

Parameters:

  • Object


15
16
17
# File 'lib/is_same/core_ext/array.rb', line 15

def elements_matching(object=nil, &block)
  self.select {|value| value.matching?(object, &block) } 
end

#elements_matching?(object = nil, &block) ⇒ Boolean

Check if any elements of an Array is same as argument.

Parameters:

  • Object

Returns:

  • (Boolean)

    Boolean



7
8
9
# File 'lib/is_same/core_ext/array.rb', line 7

def elements_matching?(object=nil, &block)
  self.any? {|value| value.matching?(object, &block) }
end

#include_same?(object) ⇒ Boolean

For backward compliability

Returns:

  • (Boolean)


3
4
5
# File 'lib/is_same/core_ext/backward_compliability/array.rb', line 3

def include_same?(object)
  elements_matching? object
end

#including_same(object) ⇒ Object

For backward compliability



7
8
9
# File 'lib/is_same/core_ext/backward_compliability/array.rb', line 7

def including_same(object)
  elements_matching object
end