Class: GrapeTokenAuth::Utility

Inherits:
Object
  • Object
show all
Defined in:
lib/grape_token_auth/utility.rb

Class Method Summary collapse

Class Method Details

.find_with_indifference(hash, key) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/grape_token_auth/utility.rb', line 4

def self.find_with_indifference(hash, key)
  if hash.key?(key.to_sym)
    return hash[key.to_sym]
  elsif hash.key?(key.to_s)
    return hash[key.to_s]
  end
  nil
end

.humanize(snake_cased) ⇒ Object



13
14
15
# File 'lib/grape_token_auth/utility.rb', line 13

def self.humanize(snake_cased)
  snake_cased.to_s.split('_').collect(&:capitalize).join
end