Skip to content

Commit

Permalink
ruby-i18n#291 - slice function will not crash if keep_key is not in t…
Browse files Browse the repository at this point in the history
…he hash
  • Loading branch information
brettcave committed Oct 1, 2014
1 parent c686d44 commit 6e4ee1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/i18n/core_ext/hash.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Hash
def slice(*keep_keys)
h = {}
keep_keys.each { |key| h[key] = fetch(key) }
keep_keys.each { |key| h[key] = fetch(key) if has_key?(key) }
h
end unless Hash.method_defined?(:slice)

Expand Down

0 comments on commit 6e4ee1b

Please sign in to comment.