summaryrefslogtreecommitdiff
path: root/lib/hashie/extensions
diff options
context:
space:
mode:
authorMax Lincoln <max@devopsy.com>2014-08-08 14:03:42 -0400
committerMax Lincoln <max@devopsy.com>2014-08-08 14:03:42 -0400
commit555c1b9273b9af9d61fefabf185f6ae662e1a2d5 (patch)
tree3a469c978cd84c3cd754714b83aef168c4d96f09 /lib/hashie/extensions
parentdcde6199006fb77dc9e87408bfed9b9215b4c559 (diff)
downloadhashie-555c1b9273b9af9d61fefabf185f6ae662e1a2d5.tar.gz
Add support for coercion to Complex and Rational
Diffstat (limited to 'lib/hashie/extensions')
-rw-r--r--lib/hashie/extensions/coercion.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/hashie/extensions/coercion.rb b/lib/hashie/extensions/coercion.rb
index c0fb8fb..d156b09 100644
--- a/lib/hashie/extensions/coercion.rb
+++ b/lib/hashie/extensions/coercion.rb
@@ -2,10 +2,12 @@ module Hashie
module Extensions
module Coercion
CORE_TYPES = {
- Integer => :to_i,
- Float => :to_f,
- String => :to_s,
- Symbol => :to_sym
+ Integer => :to_i,
+ Float => :to_f,
+ Complex => :to_c,
+ Rational => :to_r,
+ String => :to_s,
+ Symbol => :to_sym
}
def self.included(base)