Module: OOXML::Util

Included in:
Excel::Sheet
Defined in:
lib/ooxml_excel/util.rb

Constant Summary collapse

COLUMN_LETTERS =
('A'..'ZZZZ').to_a

Instance Method Summary collapse

Instance Method Details

#letter_equivalent(index) ⇒ Object



4
5
6
# File 'lib/ooxml_excel/util.rb', line 4

def letter_equivalent(index)
  COLUMN_LETTERS.fetch(index)
end

#letter_index(letter) ⇒ Object



8
9
10
# File 'lib/ooxml_excel/util.rb', line 8

def letter_index(letter)
  COLUMN_LETTERS.index { |c_letter| c_letter == letter}
end

#uniform_reference(ref) ⇒ Object



12
13
14
# File 'lib/ooxml_excel/util.rb', line 12

def uniform_reference(ref)
  ref.to_s[/[A-Z]/] ? letter_index(ref) + 1 : ref
end