Class: RgGen::SpreadsheetLoader::Spreadsheet::Position

Inherits:
Object
  • Object
show all
Defined in:
lib/rggen/spreadsheet_loader/spreadsheet/position.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, sheet, row, column) ⇒ Position

Returns a new instance of Position.



7
8
9
10
11
12
# File 'lib/rggen/spreadsheet_loader/spreadsheet/position.rb', line 7

def initialize(file, sheet, row, column)
  @file = file
  @sheet = sheet
  @row = row
  @column = column
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



14
15
16
# File 'lib/rggen/spreadsheet_loader/spreadsheet/position.rb', line 14

def file
  @file
end

#sheetObject (readonly)

Returns the value of attribute sheet.



15
16
17
# File 'lib/rggen/spreadsheet_loader/spreadsheet/position.rb', line 15

def sheet
  @sheet
end

Instance Method Details

#columnObject



21
22
23
# File 'lib/rggen/spreadsheet_loader/spreadsheet/position.rb', line 21

def column
  @column.times.inject('A') { |l, _| l.next }
end

#rowObject



17
18
19
# File 'lib/rggen/spreadsheet_loader/spreadsheet/position.rb', line 17

def row
  @row + 1
end

#to_sObject



25
26
27
# File 'lib/rggen/spreadsheet_loader/spreadsheet/position.rb', line 25

def to_s
  "file: #{file} sheet: #{sheet} row: #{row} column: #{column}"
end