summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/json/add/rational.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/json/add/rational.rb b/lib/json/add/rational.rb
index c100d13..ee39c20 100644
--- a/lib/json/add/rational.rb
+++ b/lib/json/add/rational.rb
@@ -4,9 +4,8 @@ end
defined?(::Rational) or require 'rational'
class Rational
-
- # Deserializes JSON string by converting numerator value <tt>n</tt>, denominator
- # value <tt>d</tt>, to a Rational object.
+ # Deserializes JSON string by converting numerator value <tt>n</tt>,
+ # denominator value <tt>d</tt>, to a Rational object.
def self.json_create(object)
Rational(object['n'], object['d'])
end
@@ -15,9 +14,9 @@ class Rational
# object.
def as_json(*)
{
- JSON.create_id => self.class.name,
- 'n' => numerator,
- 'd' => denominator,
+ JSON.create_id => self.class.name,
+ 'n' => numerator,
+ 'd' => denominator,
}
end
@@ -25,4 +24,4 @@ class Rational
def to_json(*)
as_json.to_json
end
-end \ No newline at end of file
+end