Hi
I am new to rho mobile and my current requirement is to read and parse a CSV File.
I am able to read the File using File.read but when it comes parse i use require 'csv' which gives me the following error :
Error: no such file to load -- csv
How to resolve this issue i have also added -csv as extension in my Build.yml file also
Any Help is appreciated
Thanks
Siddhant
2 Replies
Hi Siddhant,
Rhodes doesn't support all ruby gems. You can find out available ruby extension from https://github.com/rhomobile/rhodes/tree/master/lib/extensions.
If you need to use other gems, you should add that gem as native-extensions (http://docs.rhomobile.com/en/2.2.0/rhodes/extensions#native-extensions)
Visnupriya R
Kutir Mobility
I'm surprised that csv isn't included, since it's a core Ruby library class, and pretty sure it's just pure Ruby.
There's also this, which is pure Ruby (and the docs say that the standard CSV is pure Ruby as well):
fastercsv | RubyGems.org | your community gem host
And this:
smarter_csv | RubyGems.org | your community gem host
We do our own CSV parsing, because of some weird Excel-compatability issues, so we do not actually use this, though.
It's pretty easy to create an extension from pure Ruby code. You really shouldn't even be afraid of "native", because, in most cases, there is no platform-unique native code needed. Some Ruby Gems or libraries have some native code, but it is typically C or C++ code for performance, and only needs to be built for each platform - nothing that needs to be re-written.