Ruby Error when accessing xlsx file using roo. This script was working
until recently my system crashed and then I had to reinstall the latest
versions of Ruby and Roo. now I am getting uninitialized constant
Excelx.new (NamedError). The name a locatio of the file is correct, even
hardcoding the filename presents the same error.

I am running Ruby 1.9.3 and Roo 1.10.2
Here is the relevant part of the code:

require 'rubygems'
require 'roo'

class Fixnum
        def zeros
            "%0#{self}d" % 0
        end
end

class String
    def numeric?
        # Check if every character is numeric
        !!self.match(/^[0-9]+$/)
      end
    end

class BudgetParser
      def initialize(options)
        @budgetfile=File.basename(options[:file], '.*')
        @filename =
("#{File.expand_path(File.dirname(__FILE__))}/#{options[:file]}")
        print(@filename.force_encoding(::Encoding::UTF_8))
        @workbook =
Excelx.new(@filename.force_encoding(::Encoding::UTF_8))
        @workbook.default_sheet = options[:sheet] || 'Sheet1'
        @budget_year = options[:year] || Time.new.year.to_s
        @conversions = %w(} J K L M N O P Q R)
        import
      end

Any help would be appreciated!

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to