Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/core_ext/array.rb

Instance Method Summary collapse

Instance Method Details

#to_fObject



7
8
9
# File 'lib/core_ext/array.rb', line 7

def to_f
  map { |str| str.to_f }
end

#to_iObject



3
4
5
# File 'lib/core_ext/array.rb', line 3

def to_i
  map { |str| str.to_i }
end

#to_numObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/core_ext/array.rb', line 11

def to_num
  begin
    to_i
  rescue
    begin
      to_f
    rescue
      raise "Unable to convert #{self} #to_num"
    end
  end
end