Class: Array

Inherits:
Object show all
Defined in:
lib/array.rb

Instance Method Summary collapse

Instance Method Details

#include?(*list) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/array.rb', line 5

def include?(*list)
  list.count == 1 ? super_include?(list.first) : ( self & list ).count == list.count
end

#include_one?(*list) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/array.rb', line 9

def include_one?( *list )
  (self & list).count > 0
end

#super_include?Object



2
# File 'lib/array.rb', line 2

alias :super_include? :include?

#symbolize_hashesObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/array.rb', line 13

def symbolize_hashes
  z = []
  self.each do |i|
    z << case i
      when Array then i.symbolize_hashes
      when Hash then i.keys_to_symbols
      else
        Marshal.load(Marshal.dump(i))
      end
  end
  return z
end