list_to_columns 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b4bcd2c335f92a9e7e8bfbdb14067eb72af023c1
4
- data.tar.gz: 0d27178fc9703b0a3b65600e83b5f54ec98d34e0
2
+ SHA256:
3
+ metadata.gz: 9d42be6e6f770c149afafffc535299cd6b7803ea4f477d22e4f557038e68fb39
4
+ data.tar.gz: 508b211fd9048435ff00d73d4069d1fe125f793ba068f8db03784376c119f562
5
5
  SHA512:
6
- metadata.gz: fd89fe656b03796445c0df8fb9de8d0597fa09ccfeeecd0de258cfed16f26dcbdddd3da67f3a7493387b0b11edffcb2428d33016a0ae69a52aa5a73a32fbd595
7
- data.tar.gz: 2c89de90a80a3bef860b2e6043d7e463fffb0844f2be50459d0519df47fa967ca5b853d5f3cbd8495cc20a35d94dcc7a69b493cbe34dcc58b64f0340030372bb
6
+ metadata.gz: 735fa1d22dff7d1618117fbd5fc69a14c8d783fa87b6dcc4771d52407e0d675cb1999b9a58b6f11fd56381355c6deff3737ac93311aaba4001d58dec30acd1b3
7
+ data.tar.gz: dcd83d52eabd5dfa93f411b0fdf43de320effb8aac8f82d46f2f1b10a92381806dea93525e5fc1e98951e8ea4e53b1e3ae1162d6f17757af68062a34edff60b8
@@ -0,0 +1,43 @@
1
+ #-------------------------------------------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
4
+ #-------------------------------------------------------------------------------------------------------------
5
+
6
+ FROM ruby:2
7
+
8
+ # Avoid warnings by switching to noninteractive
9
+ ENV DEBIAN_FRONTEND=noninteractive
10
+
11
+ # This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
12
+ # property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
13
+ # will be updated to match your local UID/GID (when using the dockerFile property).
14
+ # See https://aka.ms/vscode-remote/containers/non-root-user for details.
15
+ ARG USERNAME=vscode
16
+ ARG USER_UID=1000
17
+ ARG USER_GID=$USER_UID
18
+
19
+ # Configure apt and install packages
20
+ RUN apt-get update \
21
+ && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
22
+ # Verify git, process tools installed
23
+ && apt-get -y install git openssh-client less iproute2 procps lsb-release \
24
+ #
25
+ # Install ruby-debug-ide and debase
26
+ && gem install ruby-debug-ide \
27
+ && gem install debase \
28
+ #
29
+ # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
30
+ && groupadd --gid $USER_GID $USERNAME \
31
+ && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
32
+ # [Optional] Add sudo support for the non-root user
33
+ && apt-get install -y sudo \
34
+ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
35
+ && chmod 0440 /etc/sudoers.d/$USERNAME \
36
+ #
37
+ # Clean up
38
+ && apt-get autoremove -y \
39
+ && apt-get clean -y \
40
+ && rm -rf /var/lib/apt/lists/*
41
+
42
+ # Switch back to dialog for any ad-hoc use of apt-get
43
+ ENV DEBIAN_FRONTEND=dialog
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "Ruby 2",
3
+ "dockerFile": "Dockerfile",
4
+ "settings": {
5
+ "terminal.integrated.shell.linux": "/bin/bash"
6
+ },
7
+ "extensions": [
8
+ "rebornix.Ruby",
9
+ "walkme.ruby-extension-pack"
10
+ ],
11
+ "postCreateCommand": "rm -f Gemfile.lock ; bundle install",
12
+ "remoteUser": "vscode"
13
+ }
@@ -1,2 +1,24 @@
1
- Style/MultilineOperationIndentation:
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.5
5
+ Layout/MultilineOperationIndentation:
2
6
  EnforcedStyle: indented
7
+ Layout/EmptyLinesAroundAttributeAccessor:
8
+ Enabled: true
9
+ Layout/SpaceAroundMethodCallOperator:
10
+ Enabled: true
11
+ Lint/RaiseException:
12
+ Enabled: true
13
+ Lint/StructNewOverride:
14
+ Enabled: true
15
+ Style/ExponentialNotation:
16
+ Enabled: true
17
+ Style/HashEachMethods:
18
+ Enabled: true
19
+ Style/HashTransformKeys:
20
+ Enabled: true
21
+ Style/HashTransformValues:
22
+ Enabled: true
23
+ Style/SlicingWithRange:
24
+ Enabled: true
@@ -0,0 +1,13 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-05-19 16:10:26 -0400 using RuboCop version 0.83.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: CountComments, ExcludedMethods.
11
+ # ExcludedMethods: refine
12
+ Metrics/BlockLength:
13
+ Max: 83
@@ -1,9 +1,15 @@
1
1
  language: ruby
2
2
  rvm:
3
- - '2.0'
4
- - '2.1'
5
- - '2.2'
3
+ - '2.5'
4
+ - '2.6'
5
+ - '2.7'
6
6
  script:
7
- - bundle exec rake build
7
+ - bundle exec rake build
8
8
  cache: bundler
9
- before_install: gem install bundler -v 1.10.5
9
+ before_install: gem install bundler -v 2.1.2
10
+ notifications:
11
+ slack:
12
+ on_success: change
13
+ if: branch = master
14
+ secure: XkqzaxNt2a6+jJIOP94WQppwLCRrfqDXGxBqwO9oKYAuGzWO0dHNuu8/+yEh1+S94/A1Mvk7mdC+AnpuwSmcHl3bZvwmgbVD+pBt8qMmFsmdzkm7htgjLjmbs9A0lyNsyjyN81Nm2g523fkYQ2Ubxs/3W4oQOS6W433jaz8zFISavF32N/f8zsPJ3YmsYzdMOEXk8UZFmub7Hs5+rgC0I9s2Yyrp3Bp/xUMGCePD6uo5YRcuW2VsX8xW8PW1L6zwEcXuj1+ljHZElX39bTHbzah4F6mjhBC1QpUr8RYc5FC5nEh05g6/fnMpRV2d2Mv+5fvBEOEuC/NBKHdwIK4NCTwlASAKcqK3WQ0wlmH1fTzRb09un6aNePhxmjBc+sd+8B5N9B5xqB2QBvQ1SkfnkcHnYv82hl5kjHrB3WzN4KWgyYZbt9YTnYdcAnEfVB1BDfGir+bccPSZb/13T8UcfbPgpTErcOYDqXcoPczgz7QWhSCmxxO7t70xrg/5CNNsz9zgzuTKBfjA5QYAFKTBsYV4vA64ZkM/40Ss/0cBJyJRtAYBGY20BoOy+kVWY+Nzo8NyWZzMAei3hBl8VDnwYJDFufyTzldokxDTdPmFO4wZ0I8z0RdaSmzNRmjMIcbE+JdPo8Tl1FeraFaVTV15hvM0ujrnWnvp35P9Bf+Tt6A=
15
+ email: false
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in list_to_columns.gemspec
data/README.md CHANGED
@@ -56,7 +56,7 @@ Or install it yourself as:
56
56
  Usage
57
57
  -----
58
58
 
59
- `ListToPass.new <list>, [options]`
59
+ `ListToColumns.new <list>, [options]`
60
60
 
61
61
  Options:
62
62
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'bundler/gem_tasks'
3
5
  require 'rspec/core/rake_task'
@@ -13,4 +15,4 @@ task build: [:test]
13
15
 
14
16
  # Test task
15
17
  desc 'Runs all the tests'
16
- task test: [:spec, :style]
18
+ task test: %i[spec style]
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'list_to_columns'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'list_to_columns/version'
2
4
  require 'list_to_columns/column_major'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ListToColumns
2
4
  # Columnar list that is column major order; that is the order is
3
5
  # top->bottom, then right->left.
@@ -6,10 +8,10 @@ module ListToColumns
6
8
 
7
9
  def initialize(list = nil, options = nil)
8
10
  options ||= {}
9
- @indent = options[:indent] || 0
10
- @width = options[:width] || 78
11
- @space = options[:space] || 2
12
- @strings = Array(list).map(&:to_s)
11
+ @indent = options[:indent] || 0
12
+ @width = options[:width] || 78
13
+ @space = options[:space] || 2
14
+ @strings = Array(list).map(&:to_s)
13
15
  return if @strings.empty?
14
16
 
15
17
  # Pad out list so it is rectangular.
@@ -22,23 +24,26 @@ module ListToColumns
22
24
 
23
25
  def number_of_columns
24
26
  return 0 if @strings.empty?
27
+
25
28
  @number_of_columns ||= (width + space) / (longest_string_length + space)
26
29
  end
27
30
 
28
31
  def number_of_rows
29
32
  return 0 if @strings.empty?
33
+
30
34
  @number_of_rows ||= (@strings.length.to_f / number_of_columns).ceil
31
35
  end
32
36
 
33
37
  def matrix
34
38
  return [].freeze if @strings.empty?
39
+
35
40
  @matrix ||= @strings
36
- .each_slice(number_of_rows)
37
- .to_a
38
- .transpose
39
- .map(&:compact)
40
- .map(&:freeze)
41
- .freeze
41
+ .each_slice(number_of_rows)
42
+ .to_a
43
+ .transpose
44
+ .map(&:compact)
45
+ .map(&:freeze)
46
+ .freeze
42
47
  end
43
48
 
44
49
  def to_s
@@ -1,13 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
- # Monkey patch the version number.
4
5
  module ListToColumns
5
- VERSION ||= begin
6
- semver = YAML.load(
7
- File.read(
8
- File.expand_path('../../../.semver', __FILE__)
9
- )
10
- )
11
- [semver[:major], semver[:minor], semver[:patch]].join('.')
12
- end
6
+ # This module holds the version number.
7
+ module Version
8
+ STRING = '1.1.0'
9
+ end
13
10
  end
@@ -1,37 +1,38 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'list_to_columns/version'
1
+ # frozen_string_literal: true
5
2
 
6
3
  Gem::Specification.new do |spec|
7
- spec.name = 'list_to_columns'
8
- spec.version = ListToColumns::VERSION
9
- spec.authors = ['Christian Höltje']
10
- spec.email = ['docwhat@gerf.org']
4
+ spec.name = 'list_to_columns'
5
+ spec.version = `git describe --tags`.chomp.gsub(/^v/, '')
11
6
 
12
- spec.summary = 'Formats a list into columns'
13
- spec.description = 'Given an Array of Strings, it formats it into '\
14
- 'columns to make it more compact for terminal displays.'
15
- spec.homepage = 'https://github.com/docwhat/list_to_columns'
16
- spec.license = 'MIT'
7
+ spec.authors = ['Christian Höltje']
8
+ spec.email = ['docwhat@gerf.org']
17
9
 
18
- spec.files = `git ls-files -z`
19
- .split("\x0")
20
- .reject { |f| f.match(%r{^(test|spec|features)/}) }
21
- spec.bindir = 'exe'
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
10
+ spec.summary = 'Formats a list into columns'
11
+ spec.description = 'Given an Array of Strings, it formats it into ' \
12
+ 'columns to make it more compact for terminal displays.'
13
+ spec.homepage = 'https://github.com/docwhat/list_to_columns'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`
17
+ .split("\x0")
18
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = 'exe'
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
21
  spec.require_paths = ['lib']
24
22
 
25
- spec.required_ruby_version = '>= 2.0.0'
23
+ spec.required_ruby_version = '>= 2.5.0'
26
24
 
27
- spec.add_development_dependency 'bundler', '~> 1.10'
28
- spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'bundler', '>= 1.10'
26
+ spec.add_development_dependency 'coveralls'
27
+ spec.add_development_dependency 'pry'
29
28
  spec.add_development_dependency 'psych'
29
+ spec.add_development_dependency 'rake', '>= 12.3.3'
30
30
  spec.add_development_dependency 'rspec'
31
31
  spec.add_development_dependency 'rspec-given'
32
32
  spec.add_development_dependency 'rubocop'
33
- spec.add_development_dependency 'simplecov'
34
- spec.add_development_dependency 'coveralls'
33
+ spec.add_development_dependency 'rufo'
35
34
  spec.add_development_dependency 'semver2', '~> 3.4'
36
- spec.add_development_dependency 'pry'
35
+ spec.add_development_dependency 'simplecov'
36
+ spec.add_development_dependency 'solargraph'
37
+ spec.add_development_dependency 'travis'
37
38
  end
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": ["config:base", ":automergeAll", ":automergeBranchPush"],
3
+ "timezone": "America/New_York"
4
+ }
metadata CHANGED
@@ -1,45 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: list_to_columns
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Höltje
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-21 00:00:00.000000000 Z
11
+ date: 2020-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.10'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.10'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: coveralls
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: psych
42
+ name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: psych
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,21 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec-given
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 12.3.3
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 12.3.3
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
@@ -81,7 +95,7 @@ dependencies:
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
- name: rubocop
98
+ name: rspec-given
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - ">="
@@ -95,7 +109,7 @@ dependencies:
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: simplecov
112
+ name: rubocop
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - ">="
@@ -109,7 +123,7 @@ dependencies:
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: coveralls
126
+ name: rufo
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="
@@ -137,7 +151,35 @@ dependencies:
137
151
  - !ruby/object:Gem::Version
138
152
  version: '3.4'
139
153
  - !ruby/object:Gem::Dependency
140
- name: pry
154
+ name: simplecov
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: solargraph
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: travis
141
183
  requirement: !ruby/object:Gem::Requirement
142
184
  requirements:
143
185
  - - ">="
@@ -158,9 +200,12 @@ executables: []
158
200
  extensions: []
159
201
  extra_rdoc_files: []
160
202
  files:
203
+ - ".devcontainer/Dockerfile"
204
+ - ".devcontainer/devcontainer.json"
161
205
  - ".gitignore"
162
206
  - ".rspec"
163
207
  - ".rubocop.yml"
208
+ - ".rubocop_todo.yml"
164
209
  - ".semver"
165
210
  - ".travis.yml"
166
211
  - Gemfile
@@ -173,6 +218,7 @@ files:
173
218
  - lib/list_to_columns/column_major.rb
174
219
  - lib/list_to_columns/version.rb
175
220
  - list_to_columns.gemspec
221
+ - renovate.json
176
222
  homepage: https://github.com/docwhat/list_to_columns
177
223
  licenses:
178
224
  - MIT
@@ -185,15 +231,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
231
  requirements:
186
232
  - - ">="
187
233
  - !ruby/object:Gem::Version
188
- version: 2.0.0
234
+ version: 2.5.0
189
235
  required_rubygems_version: !ruby/object:Gem::Requirement
190
236
  requirements:
191
237
  - - ">="
192
238
  - !ruby/object:Gem::Version
193
239
  version: '0'
194
240
  requirements: []
195
- rubyforge_project:
196
- rubygems_version: 2.4.8
241
+ rubygems_version: 3.1.2
197
242
  signing_key:
198
243
  specification_version: 4
199
244
  summary: Formats a list into columns