dumb_delimited 2.0.0 → 3.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: '049c4e61de54be67ca44c3b01d7f97fd5f1972953415ed339a14c55ec0c6d0c4'
4
- data.tar.gz: 38f8e15d6a44ab8af339cf4da8e8addb232c8118ba1b8603e31deb934ca95989
3
+ metadata.gz: 98873351e7fa4aeb8624f716a4de4c2090e066b8b14b138d69bd01a5c7d6f4c4
4
+ data.tar.gz: 50595400f33304f7244c850cd72750dcbc70be0caabcbf95cee61dd671167cd1
5
5
  SHA512:
6
- metadata.gz: 47aea2da44d901f3606f9e997f6024dd0413f131bec2f7f53db73863c7975a4102996f45a6eef2ffecdbf97d12c2b27132b9689dbb51f1911b1fa4f3419d9c4f
7
- data.tar.gz: a4e067dccc15b8588ab721da6e12e5175be63febce3b25198178324944e60b248a1e9927c23b738beba4df6752525c451a8eeaf65553bacf79a017a069a4dbb4
6
+ metadata.gz: 8797e92b1c578dfaa961b85d31eac7004539123fc3994f9b08ecbb05d7c6675ac01fa961e881795820b59218a27104f8ee60cd133a23a56364a77d77631bc5cc
7
+ data.tar.gz: 71795adf574729557f3524f4007c62baeee9bcb8953874362afbc5843a67c424c88dadf30531738ed57bcd56499ed5807e8fe230214bc9cee30910f0768ec514
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 3.0.0
2
+
3
+ * [BREAKING] Drop support for Ruby < 3.4
4
+ * Fix CSV keyword-argument compatibility
5
+
6
+
1
7
  ## 2.0.0
2
8
 
3
9
  * [BREAKING] Do not activate `options[:converters]` by default
data/Gemfile CHANGED
@@ -2,3 +2,6 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in dumb_delimited.gemspec
4
4
  gemspec
5
+
6
+ gem "rake", "~> 13.0"
7
+ gem "minitest", "~> 6.0"
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # dumb_delimited
2
2
 
3
- A library for unsophisticated delimited flat file IO. *dumb_delimited*
3
+ A library for unsophisticated delimited flat file IO. `dumb_delimited`
4
4
  mixes models and persistence in that "probably wrong but feels so right"
5
5
  kind of way.
6
6
 
@@ -55,7 +55,7 @@ Thus, the `Customer` class could alternatively be written as:
55
55
  Customer = DumbDelimited.psv(:name, :email, :address)
56
56
  ```
57
57
 
58
- Using our model classes, we can read each flat file, and recieve an
58
+ Using our model classes, we can read each flat file, and receive an
59
59
  array of model objects:
60
60
 
61
61
  ```ruby
@@ -105,31 +105,20 @@ end
105
105
  Product.write("products.csv", products)
106
106
  ```
107
107
 
108
- For a more detailed explanation of the *dumb_delimited* API, browse the
109
- [API documentation](http://www.rubydoc.info/gems/dumb_delimited/).
108
+ For a more detailed explanation of the `dumb_delimited` API, browse the
109
+ [API documentation](https://www.rubydoc.info/gems/dumb_delimited/).
110
110
 
111
111
 
112
112
  ## Installation
113
113
 
114
- Install from [Ruby Gems](https://rubygems.org/gems/dumb_delimited):
115
-
116
- ```bash
117
- $ gem install dumb_delimited
118
- ```
119
-
120
- Then require in your Ruby script:
121
-
122
- ```ruby
123
- require "dumb_delimited"
124
- ```
114
+ Install the [`dumb_delimited` gem](https://rubygems.org/gems/dumb_delimited).
125
115
 
126
116
 
127
117
  ## Contributing
128
118
 
129
- Run `rake test` to run the tests. You can also run `rake irb` for an
130
- interactive prompt that pre-loads the project code.
119
+ Run `rake test` to run the tests.
131
120
 
132
121
 
133
122
  ## License
134
123
 
135
- [MIT License](https://opensource.org/licenses/MIT)
124
+ [MIT License](LICENSE.txt)
data/Rakefile CHANGED
@@ -1,18 +1,5 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
- require "yard"
4
-
5
-
6
- YARD::Rake::YardocTask.new(:doc) do |t|
7
- end
8
-
9
- desc "Launch IRB with this gem pre-loaded"
10
- task :irb do
11
- require "dumb_delimited"
12
- require "irb"
13
- ARGV.clear
14
- IRB.start
15
- end
16
3
 
17
4
  Rake::TestTask.new(:test) do |t|
18
5
  t.libs << "test"
@@ -1,27 +1,27 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "dumb_delimited/version"
1
+ require_relative "lib/dumb_delimited/version"
5
2
 
6
3
  Gem::Specification.new do |spec|
7
4
  spec.name = "dumb_delimited"
8
5
  spec.version = DumbDelimited::VERSION
9
6
  spec.authors = ["Jonathan Hefner"]
10
- spec.email = ["jonathan.hefner@gmail.com"]
7
+ spec.email = ["jonathan@hefner.pro"]
11
8
 
12
- spec.summary = %q{Library for unsophisticated delimited flat file IO}
9
+ spec.summary = %q{Unsophisticated delimited flat file IO}
13
10
  spec.homepage = "https://github.com/jonathanhefner/dumb_delimited"
14
11
  spec.license = "MIT"
12
+ spec.required_ruby_version = ">= 3.4"
15
13
 
16
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
- f.match(%r{^(test|spec|features)/})
14
+ spec.metadata["source_code_uri"] = spec.homepage
15
+ spec.metadata["changelog_uri"] = spec.metadata["source_code_uri"] + "/blob/master/CHANGELOG.md"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(__dir__) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.start_with?("test/", ".git") }
18
21
  end
19
22
  spec.bindir = "exe"
20
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
24
  spec.require_paths = ["lib"]
22
25
 
23
- spec.add_development_dependency "bundler", "~> 1.15"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency "minitest", "~> 5.0"
26
- spec.add_development_dependency "yard", "~> 0.9"
26
+ spec.add_dependency "csv"
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module DumbDelimited
2
- VERSION = "2.0.0"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -6,10 +6,10 @@ module DumbDelimited
6
6
 
7
7
  # Returns a model class for delimited data consisting of the specified
8
8
  # +columns+. The returned class inherits from Ruby's
9
- # {https://docs.ruby-lang.org/en/trunk/Struct.html +Struct+}, allowing
10
- # data manipulation via accessor methods, via indexing by column name,
11
- # and via indexing by column number. See {ClassMethods} and
12
- # {InstanceMethods} for the additional methods the returned class
9
+ # {https://docs.ruby-lang.org/en/master/Struct.html +Struct+},
10
+ # allowing data manipulation via accessor methods, via indexing by
11
+ # column name, and via indexing by column number. See {ClassMethods}
12
+ # and {InstanceMethods} for the additional methods the returned class
13
13
  # provides.
14
14
  #
15
15
  # @example
@@ -97,15 +97,15 @@ end
97
97
 
98
98
  module DumbDelimited::ClassMethods
99
99
 
100
- # Returns the CSV options Hash. The Hash is not +dup+ed and can be
100
+ # Returns the CSV options Hash. The Hash is not +dup+'d and can be
101
101
  # modified directly. Any modifications will be applied to all future
102
102
  # IO operations for the model class.
103
103
  #
104
104
  # For detailed information about available options, see Ruby's
105
- # {https://docs.ruby-lang.org/en/trunk/CSV.html#method-c-new CSV
105
+ # {https://docs.ruby-lang.org/en/master/CSV.html#method-c-new CSV
106
106
  # class}.
107
107
  #
108
- # @return [Hash<Symbol, Object>]
108
+ # @return [Hash{Symbol => Object}]
109
109
  def options
110
110
  @options ||= if superclass == Struct
111
111
  CSV::DEFAULT_OPTIONS.merge(
@@ -122,11 +122,11 @@ module DumbDelimited::ClassMethods
122
122
  # class. To set options individually, see {options}.
123
123
  #
124
124
  # For detailed information about available options, see Ruby's
125
- # {https://docs.ruby-lang.org/en/trunk/CSV.html#method-c-new CSV
125
+ # {https://docs.ruby-lang.org/en/master/CSV.html#method-c-new CSV
126
126
  # class}.
127
127
  #
128
- # @param opts [Hash<Symbol, Object>]
129
- # @return [Hash<Symbol, Object>]
128
+ # @param opts [Hash{Symbol => Object}]
129
+ # @return [opts]
130
130
  def options=(opts)
131
131
  @options = opts
132
132
  end
@@ -156,7 +156,7 @@ module DumbDelimited::ClassMethods
156
156
  # p.to_s # == "1|2|3"
157
157
  #
158
158
  # @param delim [String]
159
- # @return [String]
159
+ # @return [delim]
160
160
  def delimiter=(delim)
161
161
  self.options[:col_sep] = delim
162
162
  end
@@ -195,7 +195,7 @@ module DumbDelimited::ClassMethods
195
195
  # Parses a string or IO object one line at a time, yielding a model
196
196
  # object for each line.
197
197
  #
198
- # An Enumerator is returned if no block is given.
198
+ # If no block is given, an Enumerator is returned instead.
199
199
  #
200
200
  # @overload parse_each(data, &block)
201
201
  # @param data [String, IO]
@@ -208,7 +208,7 @@ module DumbDelimited::ClassMethods
208
208
  def parse_each(data, &block)
209
209
  return to_enum(__method__, data) unless block_given?
210
210
 
211
- csv_each(CSV.new(data, self.options), &block)
211
+ csv_each(CSV.new(data, **self.options), &block)
212
212
  end
213
213
 
214
214
  # Parses a file into an array of model objects. This will load the
@@ -242,9 +242,9 @@ module DumbDelimited::ClassMethods
242
242
  # line. This avoids loading the entire contents of the file into
243
243
  # memory at once.
244
244
  #
245
- # An Enumerator is returned if no block is given. Note that some
246
- # Enumerator methods, such as +Enumerator#to_a+, can cause the entire
247
- # contents of the file to be loaded into memory.
245
+ # If no block is given, an Enumerator is returned instead. Note that
246
+ # some Enumerator methods, such as +Enumerator#to_a+, can cause the
247
+ # entire contents of the file to be loaded into memory.
248
248
  #
249
249
  # @overload read_each(path, &block)
250
250
  # @param path [String, Pathname]
@@ -257,7 +257,7 @@ module DumbDelimited::ClassMethods
257
257
  def read_each(path, &block)
258
258
  return to_enum(__method__, path) unless block_given?
259
259
 
260
- CSV.open(path, self.options) do |csv|
260
+ CSV.open(path, **self.options) do |csv|
261
261
  csv_each(csv, &block)
262
262
  end
263
263
  end
metadata CHANGED
@@ -1,80 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dumb_delimited
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Hefner
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2019-07-03 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: bundler
13
+ name: csv
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - "~>"
16
+ - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '1.15'
20
- type: :development
18
+ version: '0'
19
+ type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - "~>"
23
+ - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: '1.15'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '10.0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '5.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '5.0'
55
- - !ruby/object:Gem::Dependency
56
- name: yard
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.9'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.9'
69
- description:
25
+ version: '0'
70
26
  email:
71
- - jonathan.hefner@gmail.com
27
+ - jonathan@hefner.pro
72
28
  executables: []
73
29
  extensions: []
74
30
  extra_rdoc_files: []
75
31
  files:
76
- - ".gitignore"
77
- - ".travis.yml"
78
32
  - CHANGELOG.md
79
33
  - Gemfile
80
34
  - LICENSE.txt
@@ -86,8 +40,9 @@ files:
86
40
  homepage: https://github.com/jonathanhefner/dumb_delimited
87
41
  licenses:
88
42
  - MIT
89
- metadata: {}
90
- post_install_message:
43
+ metadata:
44
+ source_code_uri: https://github.com/jonathanhefner/dumb_delimited
45
+ changelog_uri: https://github.com/jonathanhefner/dumb_delimited/blob/master/CHANGELOG.md
91
46
  rdoc_options: []
92
47
  require_paths:
93
48
  - lib
@@ -95,15 +50,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
50
  requirements:
96
51
  - - ">="
97
52
  - !ruby/object:Gem::Version
98
- version: '0'
53
+ version: '3.4'
99
54
  required_rubygems_version: !ruby/object:Gem::Requirement
100
55
  requirements:
101
56
  - - ">="
102
57
  - !ruby/object:Gem::Version
103
58
  version: '0'
104
59
  requirements: []
105
- rubygems_version: 3.0.1
106
- signing_key:
60
+ rubygems_version: 4.0.10
107
61
  specification_version: 4
108
- summary: Library for unsophisticated delimited flat file IO
62
+ summary: Unsophisticated delimited flat file IO
109
63
  test_files: []
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.2.5
5
- before_install: gem install bundler -v 1.15.1