Method: Exfuz::Cell#initialize

Defined in:
lib/exfuz/cell.rb

#initialize(value:, row: nil, col: nil, address: nil) ⇒ Cell

Returns a new instance of Cell.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/exfuz/cell.rb', line 13

def initialize(value:, row: nil, col: nil, address: nil)
  if row && col
    @row = row
    @col = col
  elsif address
    @row, @col = to_idx(address)
  else
    raise "argument error. row: #{row}, col: #{col}, address: #{address}"
  end

  @value = value
  # valueはString型以外も含むのでマッチ用の@textは文字列に変換させる
  @text = @value.to_s
end