loady 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3cbef0a89c61259ad21fb1a9b7b1567b7e109cea5f6c9ea28ade4d86f898165
4
- data.tar.gz: befe698be1e117b169c47cf0d54b8e44c68f92a5097c57bfa3a8843f147f5547
3
+ metadata.gz: 99844f1733cb28469a0524638bda878162bd7d5a7820995f5b4662d9092a6719
4
+ data.tar.gz: 9c471fe97ae22b9d7079244fd5343cdbf602bb5aec379595d70882ae44afc064
5
5
  SHA512:
6
- metadata.gz: 732c36b0d0a5c3f74ecf03ccf42c279b9a1c0f63bff6f9c88b93a6bc90bf4856b45f5e44dfe2c838e83cef1ff8430fa00366887ba3108e5823f07a0cc82a5863
7
- data.tar.gz: d32630555756986ffd055704b47351955421214dc6424ec60e3c17b738af6896c9e49fd1e28cf37163940bcb5263e84a5873153718504d86dbcc0da9c25b774e
6
+ metadata.gz: 1826d0b630e69989b6701b26150cd13b6befcd9b0fb2cef645a3cf76e921256d986bb38d881edcec049201b6c28c0825d6d7129011c339645e655f7d819765a8
7
+ data.tar.gz: 3255ac3fee4f7e6a024863443cdacd30aa51eb2fd822abd74a6b16bd1fdad6925d7226e392f1edaa311906a06649a02742ea366a2d6a5c969c32de5d2d7c0ed7
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Loady
2
2
 
3
3
  [![Gem Version](http://img.shields.io/gem/v/loady.svg)](http://rubygems.org/gem/loady)
4
- [![Build Status](http://img.shields.io/travis/teeparham/loady.svg)](https://travis-ci.org/teeparham/loady)
5
- [![Code Climate](http://img.shields.io/codeclimate/github/teeparham/loady.svg)](https://codeclimate.com/github/teeparham/loady)
4
+ [![Build Status](https://github.com/teeparham/loady/actions/workflows/ruby.yml/badge.svg)](https://github.com/teeparham/loady/actions/workflows/ruby.yml)
6
5
  [![Coverage Status](http://img.shields.io/coveralls/teeparham/loady.svg)](https://coveralls.io/r/teeparham/loady)
7
6
 
8
7
  Loady 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.
@@ -13,13 +12,13 @@ It works with MRI ruby 1.9.3+. It uses ruby's CSV library to parse rows.
13
12
 
14
13
  ## Install
15
14
 
16
- ``` ruby
15
+ ```ruby
17
16
  gem install loady
18
17
  ```
19
18
 
20
19
  Or include the gem in your Gemfile:
21
20
 
22
- ``` ruby
21
+ ```ruby
23
22
  gem 'loady'
24
23
  ```
25
24
 
@@ -31,7 +30,7 @@ By default, messages are logged to the standard output.
31
30
 
32
31
  ### Basic usage:
33
32
 
34
- ``` ruby
33
+ ```ruby
35
34
  Loady.read "/your/file.csv" do |row|
36
35
  # handle each row
37
36
  end
@@ -39,7 +38,7 @@ end
39
38
 
40
39
  ### Skip the first row and log to a file:
41
40
 
42
- ``` ruby
41
+ ```ruby
43
42
  logger = Logger.new "/your/file.log"
44
43
 
45
44
  Loady.read "/your/file.csv", logger: logger, skip_first_row: true do |row|
@@ -49,7 +48,7 @@ end
49
48
 
50
49
  ### Name your attributes:
51
50
 
52
- ``` ruby
51
+ ```ruby
53
52
  Loady.read "/your/file.csv" do |row|
54
53
  Monkey.create row.to_attributes [:name, :year, :mom]
55
54
 
@@ -60,7 +59,7 @@ end
60
59
 
61
60
  ### Load a tab-delimited file:
62
61
 
63
- ``` ruby
62
+ ```ruby
64
63
  Loady.read "/your/file.tab", col_sep: "\t" do |row|
65
64
  # go bananas
66
65
  end
@@ -70,7 +69,7 @@ end
70
69
 
71
70
  `Loady::MemoryLoader` is a class that collects log messages in memory.
72
71
 
73
- ``` ruby
72
+ ```ruby
74
73
  memory_logger = Loady::MemoryLogger.new
75
74
 
76
75
  Loady.read "/your/file.csv", logger: memory_logger do |row|
@@ -15,12 +15,12 @@ module Loady
15
15
  # skip_first_row: true -- default = false
16
16
  # logger: Logger.new('/somewhere/file.log') -- default = Logger.new(STDOUT)
17
17
  # plus any valid options you can pass to CSV.new:
18
- # see http://www.ruby-doc.org/stdlib/libdoc/csv/rdoc/classes/CSV.html#M000190
18
+ # see https://ruby.github.io/csv/CSV.html#class-CSV-label-Options
19
19
  def read(filename, options = {}, &block)
20
20
  @logger = options.delete(:logger) || default_logger
21
21
  options[:headers] ||= options.delete(:skip_first_row)
22
22
 
23
- CSV.foreach(filename, options) do |line|
23
+ CSV.foreach(filename, **options) do |line|
24
24
  readline line, &block
25
25
  end
26
26
  @logger.info "Finished. Loaded #{@success} rows. #{@warning} skipped rows."
@@ -30,8 +30,8 @@ module Loady
30
30
  end
31
31
 
32
32
  class << self
33
- def read(*args, &block)
34
- new.read(*args, &block)
33
+ def read(*, **, &)
34
+ new.read(*, **, &)
35
35
  end
36
36
  end
37
37
 
@@ -55,7 +55,7 @@ module Loady
55
55
  end
56
56
 
57
57
  def default_logger
58
- logger = Logger.new(STDOUT)
58
+ logger = Logger.new($stdout)
59
59
  logger.datetime_format = "%H:%M:%S"
60
60
  logger
61
61
  end
data/lib/loady/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Loady
4
- VERSION = "1.1.0"
4
+ VERSION = "2.0.0"
5
5
  end
data/lib/loady.rb CHANGED
@@ -5,8 +5,8 @@ require "loady/csv_loader"
5
5
  require "loady/memory_logger"
6
6
 
7
7
  module Loady
8
- def read(*args, &block)
9
- Loady::CsvLoader.new.read(*args, &block)
8
+ def read(*, &)
9
+ Loady::CsvLoader.new.read(*, &)
10
10
  end
11
11
 
12
12
  alias csv read
metadata CHANGED
@@ -1,57 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loady
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tee Parham
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-08 00:00:00.000000000 Z
11
+ date: 2024-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: minitest
14
+ name: csv
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.5'
20
- type: :development
19
+ version: '3.2'
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.5'
27
- - !ruby/object:Gem::Dependency
28
- name: mocha
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.1'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.1'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '12.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '12.0'
26
+ version: '3.2'
55
27
  description: File loader with simple logging
56
28
  email:
57
29
  - tee@neighborland.com
@@ -69,8 +41,9 @@ files:
69
41
  homepage: https://github.com/teeparham/loady
70
42
  licenses:
71
43
  - MIT
72
- metadata: {}
73
- post_install_message:
44
+ metadata:
45
+ rubygems_mfa_required: 'true'
46
+ post_install_message:
74
47
  rdoc_options: []
75
48
  require_paths:
76
49
  - lib
@@ -78,15 +51,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
51
  requirements:
79
52
  - - ">="
80
53
  - !ruby/object:Gem::Version
81
- version: 2.4.0
54
+ version: 3.2.0
82
55
  required_rubygems_version: !ruby/object:Gem::Requirement
83
56
  requirements:
84
57
  - - ">="
85
58
  - !ruby/object:Gem::Version
86
59
  version: '0'
87
60
  requirements: []
88
- rubygems_version: 3.0.3
89
- signing_key:
61
+ rubygems_version: 3.5.23
62
+ signing_key:
90
63
  specification_version: 4
91
64
  summary: File loader with simple logging
92
65
  test_files: []