class ROdds::Odd::American
Attributes
value[R]
Public Class Methods
new(value:)
click to toggle source
# File lib/r_odds/odds/american.rb, line 6 def initialize(value:) if value.kind_of? Rational @value = value else raise ArgumentError, "ROdds::Odd::American must be initialized with a Rational value. Given a #{value.class} instance" end end
Public Instance Methods
format()
click to toggle source
# File lib/r_odds/odds/american.rb, line 14 def format :american end
negative?()
click to toggle source
# File lib/r_odds/odds/american.rb, line 22 def negative? value.negative? end
to_s()
click to toggle source
# File lib/r_odds/odds/american.rb, line 18 def to_s "%+d" % value end