Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/cssensible/ruby_extensions.rb

Overview

Extensions to built-in Ruby classes.

Instance Method Summary collapse

Instance Method Details

#include_all?(array) ⇒ Boolean

:call-seq:

include_all?(array) -> true or false

Returns true if all elements of the given array is present in self, false otherwise.

a = ["a", "b", "c"]
a.include_all?(["a", "c"])            # => true
a.include_all?(["a", "b", "c", "d"])  # => false

Returns:

  • (Boolean)


12
13
14
15
16
17
# File 'lib/cssensible/ruby_extensions.rb', line 12

def include_all?(array)
  array.each do |element|
    return false unless self.include?(element)
  end
  return true
end