class Languages::Generic::Dots

Public Class Methods

new(int) click to toggle source
# File lib/languages/generic/dots.rb, line 4
def initialize(int)
  @int = int
end

Public Instance Methods

+(other) click to toggle source
# File lib/languages/generic/dots.rb, line 12
def +(other)
  self.class.new(@int + value_of(other))
end
-(other) click to toggle source
# File lib/languages/generic/dots.rb, line 16
def -(other)
  self.class.new(@int - value_of(other))
end
==(other) click to toggle source
# File lib/languages/generic/dots.rb, line 20
def ==(other)
  @int == value_of(other)
end
to_dots() click to toggle source
# File lib/languages/generic/dots.rb, line 24
def to_dots
  self
end
to_i() click to toggle source
# File lib/languages/generic/dots.rb, line 8
def to_i
  @int
end
to_s() click to toggle source
# File lib/languages/generic/dots.rb, line 28
def to_s
  @int.to_s
end

Private Instance Methods

value_of(other) click to toggle source
# File lib/languages/generic/dots.rb, line 32
def value_of(other)
  v = other.respond_to?(:to_dots) ? other.to_dots.to_i : other.to_i
end