diff options
author | Vipul A M <vipulnsward@gmail.com> | 2014-07-03 10:41:16 +0530 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2014-07-03 10:41:16 +0530 |
commit | 8594c69af548ce9c3f8240f40f1d64f5378cd245 (patch) | |
tree | 6066a6e8cfbc5c6a0e43cee3f502418ac9681f97 | |
parent | b93b23d87458bc1999ea9829926a097ff5b45213 (diff) | |
download | json-8594c69af548ce9c3f8240f40f1d64f5378cd245.tar.gz |
Use method_defined? to check if method exists instead of slower check on instance_methods
-rw-r--r-- | lib/json/add/time.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/json/add/time.rb b/lib/json/add/time.rb index 338209d..d983467 100644 --- a/lib/json/add/time.rb +++ b/lib/json/add/time.rb @@ -10,7 +10,7 @@ class Time if usec = object.delete('u') # used to be tv_usec -> tv_nsec object['n'] = usec * 1000 end - if instance_methods.include?(:tv_nsec) + if method_defined?(:tv_nsec) at(object['s'], Rational(object['n'], 1000)) else at(object['s'], object['n'] / 1000) |