In Files

  • mrbgems/mruby-rational/test/rational.rb

Parent

Methods

UserDefinedNumeric

Public Class Methods

new(n) click to toggle source
 
               # File mrbgems/mruby-rational/test/rational.rb, line 2
def initialize(n)
  @n = n
end
            

Public Instance Methods

<=>(rhs) click to toggle source
 
               # File mrbgems/mruby-rational/test/rational.rb, line 6
def <=>(rhs)
  return nil unless rhs.respond_to?(:to_i)
  rhs = rhs.to_i
  rhs < 0 ? nil : @n <=> rhs
end
            
inspect() click to toggle source
 
               # File mrbgems/mruby-rational/test/rational.rb, line 12
def inspect
  "#{self.class}(#{@n})"
end