lib/stellar/price.rb in stellar-base-0.0.3 vs lib/stellar/price.rb in stellar-base-0.0.4
- old
+ new
@@ -11,11 +11,22 @@
n: best_r.numerator,
d: best_r.denominator
})
end
+ def invert
+ self.class.new(n:d,d:n)
+ end
+
def to_f
n / d.to_f
end
+ def to_s
+ "#{n} / #{d}"
+ end
+
+ def inspect
+ "#<Stellar::Price #{self}>"
+ end
end
end
\ No newline at end of file