Skip to content
This repository was archived by the owner on May 11, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/roo/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def find(*args) # :nodoc
[col, cell(@header_line,col)]
end]
#-- id
if args[0].class == Fixnum
if args[0].class == Integer
rownum = args[0]
if @header_line
[Hash[1.upto(self.row().size).map {|j|
Expand Down Expand Up @@ -309,7 +309,7 @@ def set(row,col,value,sheet=nil) #:nodoc:
read_cells(sheet)
row, col = normalize(row,col)
cell_type = case value
when Fixnum then :float
when Integer then :float
when String, Float then :string
else
raise ArgumentError, "Type for #{value} not set"
Expand Down Expand Up @@ -623,7 +623,7 @@ def set_type(row,col,type,sheet=nil)
# converts cell coordinate to numeric values of row,col
def normalize(row,col)
if row.class == String
if col.class == Fixnum
if col.class == Integer
# ('A',1):
# ('B', 5) -> (5, 2)
row, col = col, row
Expand Down Expand Up @@ -711,7 +711,7 @@ def validate_sheet!(sheet)
case sheet
when nil
raise ArgumentError, "Error: sheet 'nil' not valid"
when Fixnum
when Integer
self.sheets.fetch(sheet-1) do
raise RangeError, "sheet index #{sheet} not found"
end
Expand Down
4 changes: 2 additions & 2 deletions lib/roo/excel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def validate_sheet!(sheet)

# converts name of a sheet to index (0,1,2,..)
def sheet_no(name)
return name - 1 if name.is_a?(Fixnum)
return name - 1 if name.is_a?(Integer)
worksheets.each_with_index do |worksheet, index|
return index if name == normalize_string(worksheet.name)
end
Expand Down Expand Up @@ -306,7 +306,7 @@ def read_cell(row, idx)

cell = read_cell_content(row, idx)
case cell
when Integer, Fixnum, Bignum
when Integer
value_type = :float
value = cell.to_i
when Float
Expand Down
2 changes: 1 addition & 1 deletion lib/roo/excelx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def sheets
# returns the sheet index by name
# passed indexes through
def sheet_index(sheet)
if sheet.is_a?(Fixnum)
if sheet.is_a?(Integer)
sheet
else
sheets.index(sheet)
Expand Down
2 changes: 1 addition & 1 deletion scripts/txt2html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require File.dirname(__FILE__) + '/../lib/roo/version.rb'
version = Roo::VERSION::STRING
download = 'http://rubyforge.org/projects/roo'

class Fixnum
class Integer
def ordinal
# teens
return 'th' if (10..19).include?(self % 100)
Expand Down