Hey all. Sorry Sameer & Victor, I had overlooked this issue regarding the partial-requires discussion during today's video conference session and it struck me just now.
This is regarding multiple gems (say, faster_csv, csv, fastest_csv) that are used for the same format (says, csv) in both partial require (require ‘daru/io/importers/faster_csv’`) as well as full require (require ‘daru/io’`).
Now, according to today’s video conference and the proposed architecture, we discussed to have them as separate files like daru/io/importers/{csv.rb, faster_csv.rb, etc.}.rb, with Daru::DataFrame#from_csv linkage, importer and helper functions in each file. This definitely works in the case of partial require - but poses a problem of overriding within these Daru::DataFrame#from_csv linkages in the case of full require.
That is, while requiring daru/io, all the same-format different-gem files like csv.rb, faster_csv.rb, fastest_csv.rb will separately override the Daru::DataFrame#from_csv. And as they’re required by the main importers.rb file in a certain order, two (all but one) of these overrides will be overridden, and only one Dare:DataFrame#from_csv linkage will survive.
This was what I had in mind while posing the idea that all different gems should be in the same csv.rb file, but as different modules (if required), or just different functions within the core CSV module. I'm imagining something like this -
```
#! daru/io/importers/csv.rb
module Daru
class DataFrame
class << self
def from_csv path, opts={}, &block
if opts[:gem].nil? || opts[:gem] == :csv # Default gem
Daru::IO::Importers::CSV.load path, opts, &block
elsif opts[:gem] == :faster_csv
Daru::IO::Importers::FasterCSV.load path, opts, &block
...
end
end
end
end
end
# Followed by Daru::IO::Importers::CSV#load, Daru:IO:Importers::CSVHelper
# Followed by Daru::IO::Importers::FasterCSV#load, Daru::IO::Importers::FasterCSVHelper (No specific order)
```
Please let me know if you have a better architecture in mind that works in both cases - partial requires as well as full require.
Regards,
Athitya Kumar