0.0
No commit activity in last 3 years
No release in over 3 years
'csv_class_maker will create a class out of your csv's headers, and provide some methods for finding data in the CSV'
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 3.9.0
~> 0.82

Runtime

~> 1.0.0
 Project Readme

CSV Class Maker v2.0.0

Code Climate

CSV Class Maker creates classes out of your CSV headers with some pretty simple search functionality you're probably already comfortable with.

This gem is really a wrapper around csv_find which may suit your needs better.

Usage

Install

gem install csv_class_maker

Generate a class to represent the data in your CSV.

CsvClassMaker::generate_class('Yourclass', '/path/to/your.csv')

You can pass in other delimiters, like a tab.

CsvClassMaker::generate_class('Yourclass', '/path/to/your.csv', col_sep: "\t")

Now you have a class with setters and getters based on the headers of the csv file.

All methods return an instance of Yourclass or an array of Yourclass.

Methods

Yourclass.new
Yourclass.find(line_number)
Yourclass.where(header1: 'value', header2: 'value')
Yourclass.first
Yourclass.last
Yourclass.each { |a| a.method  }

Plus, as of v1.0.4, the Enumerable module is implemented in all CSV classes!

License

CSV Class Maker is Copyright © 2020 Mark Platt, Inc. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.