class Greentable::Counter

Public Class Methods

new(size) click to toggle source
# File lib/greentable/greentable_counter.rb, line 3
def initialize(size)
  @i = 0
  @max = size
end

Public Instance Methods

even?() click to toggle source
# File lib/greentable/greentable_counter.rb, line 32
def even?
  @i%2==1
end
first?() click to toggle source
# File lib/greentable/greentable_counter.rb, line 16
def first?
  @i == 0
end
i() click to toggle source
# File lib/greentable/greentable_counter.rb, line 8
def i
  @i
end
inc() click to toggle source
# File lib/greentable/greentable_counter.rb, line 24
def inc
  @i += 1
end
last?() click to toggle source
# File lib/greentable/greentable_counter.rb, line 20
def last?
  @i >= (@max-1)
end
odd?() click to toggle source
# File lib/greentable/greentable_counter.rb, line 28
def odd?
  @i%2==0
end
to_s() click to toggle source
# File lib/greentable/greentable_counter.rb, line 12
def to_s
  @i.to_s
end