Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/better_jira/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#require_keys!(*keys) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/better_jira/core_ext.rb', line 6

def require_keys!(*keys)
  missing = []
  
  keys.each do |key|
    missing << key unless self.has_key? key
  end

  raise "Required keys: #{missing.join(", ")}" unless missing.empty?
end

#symbolize_keys!Object



2
3
4
# File 'lib/better_jira/core_ext.rb', line 2

def symbolize_keys!
  replace(inject({}) { |h,(k,v)| h[k.to_sym] = v; h })
end