Skip to content

Commit

Permalink
get rid of refine for ruby19 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex V committed Oct 4, 2015
1 parent 7878f59 commit 90b0898
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/alexa_rubykit/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,10 @@ def self.build_request(json_request)
@request
end

# Let's monkey patch Hash.
refine Hash do
# Take keys of hash and transform those to a symbols
def self.transform_keys_to_symbols(value)
return value if not value.is_a?(Hash)
hash = value.inject({}){|memo,(k,v)| memo[k.to_sym] = Hash.transform_keys_to_symbols(v); memo}
return hash
end
# Take keys of hash and transform those to a symbols
def self.transform_keys_to_symbols(value)
return value if not value.is_a?(Hash)
hash = value.inject({}){|memo,(k,v)| memo[k.to_sym] = self.transform_keys_to_symbols(v); memo}
return hash
end
end
end

0 comments on commit 90b0898

Please sign in to comment.