75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/ppp/card/base.rb', line 75
def passcode *args
case args.size
when 1
match = @@ROW_COL_PATTERN.match( args.first )
raise ArgumentError.new( @@ERROR_BAD_ROW_COL % args.first ) unless match
row = match[1]
col = match[2]
when 2
(row, col) = args
else
raise ArgumentError.new( @@ERROR_WRONG_NUM_ARGS % ['1 or 2', args.size] )
end
col_offset = col.ord - @@FIRST_COLUMN.ord
row_offset = row.to_i - 1
offset = row_offset * passcodes_per_line + col_offset
offset = card_offset + offset
@generator.passcode offset
end
|