Sha256: 4c44b4bf46654d78283342a068d9db11dd71aadcddf9fda19248ae0d8d4f8591

Contents?: true

Size: 802 Bytes

Versions: 11

Compression:

Stored size: 802 Bytes

Contents

# encoding: utf-8

module Enumerable
  # Checks whether #all? collection elements are #kind_of? module
  # supplied as an argument
  # 
  def all_kind_of?( kind )
    all? {|e| e.kind_of? kind }
  end
  
  # Checks whether #all? collection elements are #kind_of? Numeric.
  # 
  def all_numeric?
    all? {|e| e.kind_of? Numeric }
  end
  
  # Checks whether the receiver collection is fully included in the
  # collection supplied as an argument.
  # 
  def subset_of?( other_collection )
    all? {|e| other_collection.include? e }
  end
  alias :⊂? :subset_of?
  
  # Checks whether the receiver collection contains every element of
  # the collection supplied as an argument.
  # 
  def superset_of?( other_collection )
    other.all? {|e| self.include? e }
  end
  alias :⊃? :superset_of?
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
y_support-2.5.3 lib/y_support/core_ext/enumerable/misc.rb
y_support-2.5.2 lib/y_support/core_ext/enumerable/misc.rb
y_support-2.5.1 lib/y_support/core_ext/enumerable/misc.rb
y_support-2.4.6 lib/y_support/core_ext/enumerable/misc.rb
y_support-2.4.5 lib/y_support/core_ext/enumerable/misc.rb
y_support-2.4.4 lib/y_support/core_ext/enumerable/misc.rb
y_support-2.1.18 lib/y_support/core_ext/enumerable/misc.rb
y_support-2.1.17 lib/y_support/core_ext/enumerable/misc.rb
y_support-2.1.16 lib/y_support/core_ext/enumerable/misc.rb
y_support-2.1.13 lib/y_support/core_ext/enumerable/misc.rb
y_support-2.1.12 lib/y_support/core_ext/enumerable/misc.rb