{"id":17220488,"url":"https://github.com/teeparham/loady","last_synced_at":"2025-04-13T23:46:17.084Z","repository":{"id":1309937,"uuid":"1253418","full_name":"teeparham/loady","owner":"teeparham","description":"Simple file reader and logger","archived":false,"fork":false,"pushed_at":"2024-12-02T22:52:15.000Z","size":91,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-06T16:50:09.023Z","etag":null,"topics":["csv","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/teeparham.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-01-14T04:45:24.000Z","updated_at":"2024-12-02T22:52:19.000Z","dependencies_parsed_at":"2022-07-18T21:34:37.787Z","dependency_job_id":null,"html_url":"https://github.com/teeparham/loady","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teeparham%2Floady","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teeparham%2Floady/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teeparham%2Floady/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teeparham%2Floady/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teeparham","download_url":"https://codeload.github.com/teeparham/loady/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248799694,"owners_count":21163398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","ruby"],"created_at":"2024-10-15T03:52:27.315Z","updated_at":"2025-04-13T23:46:17.054Z","avatar_url":"https://github.com/teeparham.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Loady\n\n[![Gem Version](http://img.shields.io/gem/v/loady.svg)](http://rubygems.org/gem/loady)\n[![Build Status](https://github.com/teeparham/loady/actions/workflows/ruby.yml/badge.svg)](https://github.com/teeparham/loady/actions/workflows/ruby.yml)\n[![Coverage Status](http://img.shields.io/coveralls/teeparham/loady.svg)](https://coveralls.io/r/teeparham/loady)\n\nLoady is a simple file reader and logger. Use it to read any delimited file. Loady makes it easy to conveniently convert input fields to an attribute hash, continue on error rows, and do basic logging.\n\nLoady was initially created to load hundreds of millions of rows from CSV files that had various data errors.\n\nIt works with MRI ruby 1.9.3+. It uses ruby's CSV library to parse rows.\n\n## Install\n\n```ruby\ngem install loady\n```\n\nOr include the gem in your Gemfile:\n\n```ruby\ngem 'loady'\n```\n\n## Use\n\nIf an error occurs, Loady will continue reading the file, ignoring problem rows and logging a warning for each.\n\nBy default, messages are logged to the standard output.\n\n### Basic usage:\n\n```ruby\nLoady.read \"/your/file.csv\" do |row|\n  # handle each row\nend\n```\n\n### Skip the first row and log to a file:\n\n```ruby\nlogger = Logger.new \"/your/file.log\"\n\nLoady.read \"/your/file.csv\", logger: logger, skip_first_row: true do |row|\n  puts \"#{row[0]}, #{row[1]}, etc.\"\nend\n```\n\n### Name your attributes:\n\n```ruby\nLoady.read \"/your/file.csv\"  do |row|\n  Monkey.create row.to_attributes [:name, :year, :mom]\n\n  # row.to_attributes [:name, :year, :mom]\n  # =\u003e { name: 'Bubbles', year: 2000, mom: 'Momma Bubbles' }\nend\n```\n\n### Load a tab-delimited file:\n\n```ruby\nLoady.read \"/your/file.tab\", col_sep: \"\\t\"  do |row|\n  # go bananas\nend\n```\n\n### Collect log messages in memory\n\n`Loady::MemoryLoader` is a class that collects log messages in memory.\n\n```ruby\nmemory_logger = Loady::MemoryLogger.new\n\nLoady.read \"/your/file.csv\", logger: memory_logger do |row|\n  # do things\nend\n\nmemory_logger.messages\n=\u003e [\n    'Line 123: Something bad happened.',\n    'Line 456: Exception of some sort.',\n    'Finished. Loaded 9998 rows. 2 unprocessed rows.'\n   ]\n```\n\n## Major Change in 1.0\n\nUp to version 1.0, `loady` worked fundamentally differently than ruby's CSV\nparser in that it did not support newlines. The benefit was that lines\nwith errant newlines could easily be ignored.\n\nIn version 1.0+, `loady` works like the stdlib ruby CSV parser, and you\nmust have properly formed CSV rows.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteeparham%2Floady","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteeparham%2Floady","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteeparham%2Floady/lists"}