<commit_before>= Loady - A CSV file loader with simple logging

Loady is a simple file reader and logger. Use it to quickly load any delimited file, continue on error rows, and do basic logging.

It works with ruby 1.9. It uses ruby's CSV library to parse rows.

== Install

  gem install loady

Or include the gem in your Gemfile:

  gem 'loady'

== Use

If an error occurs, Loady will continue reading the file, ignoring problem rows and logging a warning for each.

By default, messages are logged to the standard output.

Basic usage:

  Loady.csv "/your/file.csv" do |row|
    # your code to process each row goes here
    puts "#{row[0]}, #{row[1]}, etc."
  end

Skip the first row and log to a file:

  logger = Logger.new "/your/file.log"

  Loady.csv "/your/file.csv", logger: logger, skip_first_row: true do |row|
    # do some stuff for each row
  end

Name your attributes:

  Loady.csv "/your/file.csv"  do |row|
    Monkey.create row.to_attributes [:name, :year, :mom]
  end

Load a tab-delimited file:

  Loady.csv "/your/file.tab", col_sep: "\t"  do |row|
    # go bananas 
  end

== Development

  git clone git://github.com/teeparham/loady.git
  cd loady
  bundle
  bundle exec rake
<commit_msg>readme: make Loady.read the preferred usage<commit_after>= Loady - A CSV file loader with simple logging

Loady is a simple file reader and logger. Use it to quickly load any delimited file, continue on error rows, and do basic logging.

It works with ruby 1.9. It uses ruby's CSV library to parse rows.

== Install

  gem install loady

Or include the gem in your Gemfile:

  gem 'loady'

== Use

If an error occurs, Loady will continue reading the file, ignoring problem rows and logging a warning for each.

By default, messages are logged to the standard output.

Basic usage:

  Loady.read "/your/file.csv" do |row|
    # your code to process each row goes here
    puts "#{row[0]}, #{row[1]}, etc."
  end

Skip the first row and log to a file:

  logger = Logger.new "/your/file.log"

  Loady.read "/your/file.csv", logger: logger, skip_first_row: true do |row|
    # do some stuff for each row
  end

Name your attributes:

  Loady.read "/your/file.csv"  do |row|
    Monkey.create row.to_attributes [:name, :year, :mom]
  end

Load a tab-delimited file:

  Loady.read "/your/file.tab", col_sep: "\t"  do |row|
    # go bananas 
  end

== Development

  git clone git://github.com/teeparham/loady.git
  cd loady
  bundle
  bundle exec rake

{'fraction_non_alphanumeric': 0.09349593495934959, 'fraction_numerical': 0.0032520325203252032, 'mean_word_length': 3.192504258943782, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1813633', 'n_tokens_mistral': 827, 'n_tokens_neox': 792, 'n_words': 345}