Class: Hash

Inherits:
Object show all
Defined in:
lib/hcheck/helper.rb

Overview

Enhance Hash Imported from rails/active_support

Instance Method Summary collapse

Instance Method Details

#except(*keys) ⇒ Object



14
15
16
# File 'lib/hcheck/helper.rb', line 14

def except(*keys)
  dup.except!(*keys)
end

#except!(*keys) ⇒ Object



18
19
20
21
# File 'lib/hcheck/helper.rb', line 18

def except!(*keys)
  keys.each { |key| delete(key) }
  self
end

#symbolize_keysObject



4
5
6
7
8
9
10
11
12
# File 'lib/hcheck/helper.rb', line 4

def symbolize_keys
  each_with_object({}) do |(key, value), options|
    options[(begin
               key.to_sym
             rescue StandardError
               key
             end) || key] = value
  end
end