Class: ShareProgress::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/share_progress/utils.rb

Class Method Summary collapse

Class Method Details

.filter_keys(params, acceptable) ⇒ Object



7
8
9
10
# File 'lib/share_progress/utils.rb', line 7

def filter_keys(params, acceptable)
  return params if params.nil?
  params.select!{ |key, _| acceptable.include? key }
end

.symbolize_keys(params) ⇒ Object



12
13
14
15
16
# File 'lib/share_progress/utils.rb', line 12

def symbolize_keys(params)
  fresh = Hash.new
  params.each_pair{ |k, v| fresh[k.to_sym] = v }
  fresh
end