I am sketching out how would CsvVerify module work. Is there a way to not polute class that will include the module with instance variables
Idea is inspired by virtus and goes something like this:
employee_csv_importer.rb (using the module)
class EmployeeCsvImporter
include CsvVerify
headers 'ID', 'First Name', 'Last Name', 'Title or Department',
'Age', 'Native Language', 'Fluent in English?'
end
csv_verify.rb
module CsvVerify
puts "included"
def headers(*names)
@config = Config.new
end
end
config.rb
module CsvVerify
class Config
end
end
So how do I reorganize this to avoid polluting EmployeeCsvImporter with @config?
PS.
And why doesn't this even work now?
Why do I get this output from running employee_csv_importer.rb?
included
/data/gems/csv_verify/examples/1_employees.rb:6:in `<class:EmployeeCsvImporter>':
undefined method `headers' for EmployeeCsvImporter:Class (NoMethodError)