Class: Tankobon::SequenceTransform

Inherits:
Transform
  • Object
show all
Defined in:
lib/tankobon/transform.rb

Instance Method Summary collapse

Methods inherited from Transform

#to_proc

Constructor Details

#initialize(seq = -1,, padding = 5) ⇒ SequenceTransform

Returns a new instance of SequenceTransform.



13
14
15
16
# File 'lib/tankobon/transform.rb', line 13

def initialize(seq=-1, padding=5)
  @seq = seq
  @padding = padding
end

Instance Method Details

#pad(num) ⇒ Object



18
19
20
# File 'lib/tankobon/transform.rb', line 18

def pad(num)
  "%0#{@padding}d" % num
end

#transform(input) ⇒ Object



22
23
24
# File 'lib/tankobon/transform.rb', line 22

def transform(input)
  pad(@seq += 1)
end