Class: Mo2tex::Pic::Counter

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/mo2tex/pic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCounter

Returns a new instance of Counter.



19
20
21
# File 'lib/mo2tex/pic.rb', line 19

def initialize
  self.reset
end

Instance Attribute Details

#cntrObject (readonly)

Returns the value of attribute cntr.



15
16
17
# File 'lib/mo2tex/pic.rb', line 15

def cntr
  @cntr
end

#pgObject (readonly)

Returns the value of attribute pg.



15
16
17
# File 'lib/mo2tex/pic.rb', line 15

def pg
  @pg
end

#slotObject (readonly)

Returns the value of attribute slot.



15
16
17
# File 'lib/mo2tex/pic.rb', line 15

def slot
  @slot
end

Instance Method Details

#next_cntrObject



31
32
33
# File 'lib/mo2tex/pic.rb', line 31

def next_cntr
  return nxt(:cntr)
end

#next_pgObject



27
28
29
# File 'lib/mo2tex/pic.rb', line 27

def next_pg
  return nxt(:pg)
end

#next_slotObject



35
36
37
# File 'lib/mo2tex/pic.rb', line 35

def next_slot
  return nxt(:slot)
end

#prev_cntr(back = 1) ⇒ Object



43
44
45
# File 'lib/mo2tex/pic.rb', line 43

def prev_cntr(back = 1)
  return self.cntr == 0 ? self.cntr : self.cntr-back
end

#prev_pgObject



39
40
41
# File 'lib/mo2tex/pic.rb', line 39

def prev_pg
  return self.pg == 0 ? self.pg : self.pg-1
end

#prev_slot(back = 1) ⇒ Object



47
48
49
# File 'lib/mo2tex/pic.rb', line 47

def prev_slot(back = 1)
  return self.slot == 0 ? self.slot : self.slot-back
end

#resetObject



23
24
25
# File 'lib/mo2tex/pic.rb', line 23

def reset
  @pg = @cntr = @slot = 0
end