Sha256: 44fa08c5d52671d0048b94cede4fe4d0a0efb5c497731560540b9ff72aeca37e

Contents?: true

Size: 324 Bytes

Versions: 1

Compression:

Stored size: 324 Bytes

Contents

class IntVariable
  def do
    ret = yield

    if ret.class <= Integer
      @value = ret
    else
      raise
    end
  end

  def to_i
    @value
  end

  def +(n)
    @value + n
  end

  def -(n)
    @value - n
  end

  def *(n)
    @value * n
  end

  def /(n)
    @value / n
  end

  def %(n)
    @value % n
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
static_type-0.0.1 lib/static_type/int_variable.rb