Module: RZoopla::Utils

Defined in:
lib/zoopla/utils.rb,
lib/rzoopla/utils.rb

Class Method Summary collapse

Class Method Details

.pluck(hash, *args) ⇒ Object



4
5
6
# File 'lib/zoopla/utils.rb', line 4

def pluck(hash, *args)
  Hash[hash.find_all { |k, _| args.include?(k) }]
end

.symbolize_keys(obj) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/zoopla/utils.rb', line 8

def symbolize_keys(obj)
  case obj
  when Hash  then symbolize_keys_hash(obj)
  when Array then symbolize_keys_array(obj)
  else            obj
  end
end