fedux_org-stdlib 0.6.45 → 0.6.46

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
2
  SHA1:
3
- metadata.gz: f0b710df8eb8a0bdb8422a96b6328d5d1d1d38b0
4
- data.tar.gz: 3d3e641290c629d40d94e0e6aa6ae6244f8bbf3c
3
+ metadata.gz: 4f30dfb18ded39d3f9d21aee9ed56bb87e4d868e
4
+ data.tar.gz: 148ee56c2e9d7b9c0eed83934c7a3d0b6e57496d
5
5
  SHA512:
6
- metadata.gz: f693b5182a544a069a4b2a6598b051c6b9cbcc0448aae16f0be2e0ba27f3e85f6f2b74fb63d94145924bd9d0b8703e36cc5c89fe2053d6321dcde00d985da73d
7
- data.tar.gz: b473d0686fcd13a36a7763b8cd29663364e0e4125bdeed224d102bd03d7fa1484230c410cd88759eb1f6c340aaac10b913d1aff9ad96b6164fdf4ffd921ae560
6
+ metadata.gz: e80bfb364cd3b361decb1f761e56966b1cdb5e58f8af6091bf101039d64f0cb803d7970acfecead55a6a7fc1ecb5b8ebfe64e9eea3115fdd6ef941b01012745d
7
+ data.tar.gz: 3d1627b20c6916bc742a64aef48f5dd5178907c5818cb15a33386ac0681da05eb79fe557a09b8d231520f1d0c9793ffa2db32a81f64fa63aefad4ca76ae7a1a9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fedux_org-stdlib (0.6.44)
4
+ fedux_org-stdlib (0.6.45)
5
5
  activesupport
6
6
 
7
7
  GEM
@@ -234,7 +234,14 @@ module FeduxOrgStdlib
234
234
  result << sprintf("%s + %s", '-' * length, '-' * 80)
235
235
 
236
236
  self.class._known_options.each do |o|
237
- result << sprintf("%#{length}s | %s", o, Array(public_send(o)).join(', '))
237
+ value = public_send(o)
238
+
239
+ value = if value.is_a? Hash
240
+ value.to_list
241
+ else
242
+ Array(value).to_list
243
+ end
244
+ result << sprintf("%#{length}s | %s", o, value)
238
245
  end
239
246
 
240
247
  result.join("\n")
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ class Array
3
+ def to_list
4
+ self.map { |l| format('"%s"', l) }.join(", ")
5
+ end
6
+ end
@@ -1,6 +1,3 @@
1
1
  # encoding: utf-8
2
- class Array
3
- def to_list
4
- self.map { |l| format('"%s"', l) }.join(", ")
5
- end
6
- end
2
+
3
+ Dir.glob(File.expand_path('../array/**/*.rb', __FILE__)).each { |f| require_relative f }
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+ require 'fedux_org_stdlib/core_ext/array/list'
3
+
4
+ class Hash
5
+ def to_list
6
+ self.map { |key, value| format('%s: %s', key, value) }.to_list
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ # encoding: utf-8
2
+
3
+ Dir.glob(File.expand_path('../hash/**/*.rb', __FILE__)).each { |f| require_relative f }
@@ -0,0 +1,3 @@
1
+ # encoding: utf-8
2
+
3
+ Dir.glob(File.expand_path('../shellwords/**/*.rb', __FILE__)).each { |f| require_relative f }
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # FeduxOrgStdlib
3
3
  module FeduxOrgStdlib
4
- VERSION = '0.6.45'
4
+ VERSION = '0.6.46'
5
5
  end
@@ -343,6 +343,7 @@ RSpec.describe AppConfig do
343
343
  config_klass = Class.new(AppConfig) do
344
344
  option :opt1, 'test1'
345
345
  option :opt2, 'test2'
346
+ option :opt3, { opt1: 'test1', opt2: 'test2' }
346
347
 
347
348
  def _class_name
348
349
  'TestConfig'
@@ -357,8 +358,9 @@ RSpec.describe AppConfig do
357
358
  expect(config.to_s).to eq <<-EOS.strip_heredoc.chomp
358
359
  option | value
359
360
  ------ + --------------------------------------------------------------------------------
360
- opt1 | test1
361
- opt2 | test2
361
+ opt1 | "test1"
362
+ opt2 | "test2"
363
+ opt3 | "opt1: test1", "opt2: test2"
362
364
  EOS
363
365
  end
364
366
  end
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'fedux_org_stdlib/core_ext/array/list'
4
+
5
+ RSpec.describe Array do
6
+ context '#to_list' do
7
+ it 'converts array to a list of values' do
8
+ input = %w{ asdf asdf asdf}
9
+
10
+ expect(input.to_list).to eq '"asdf", "asdf", "asdf"'
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'fedux_org_stdlib/core_ext/hash/list'
4
+
5
+ RSpec.describe Array do
6
+ context '#to_list' do
7
+ it 'converts array to a list of values' do
8
+ input = {
9
+ opt1: 'asdf',
10
+ opt2: 'asdf'
11
+ }
12
+
13
+ expect(input.to_list).to eq '"opt1: asdf", "opt2: asdf"'
14
+ end
15
+ end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fedux_org-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.45
4
+ version: 0.6.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Meyer
@@ -57,7 +57,11 @@ files:
57
57
  - lib/fedux_org_stdlib/command/run_command.rb
58
58
  - lib/fedux_org_stdlib/command/which.rb
59
59
  - lib/fedux_org_stdlib/core_ext/array.rb
60
+ - lib/fedux_org_stdlib/core_ext/array/list.rb
61
+ - lib/fedux_org_stdlib/core_ext/hash.rb
62
+ - lib/fedux_org_stdlib/core_ext/hash/list.rb
60
63
  - lib/fedux_org_stdlib/core_ext/hash/options.rb
64
+ - lib/fedux_org_stdlib/core_ext/shellwords.rb
61
65
  - lib/fedux_org_stdlib/core_ext/shellwords/clean.rb
62
66
  - lib/fedux_org_stdlib/core_ext/string.rb
63
67
  - lib/fedux_org_stdlib/environment.rb
@@ -139,6 +143,8 @@ files:
139
143
  - spec/colors/html_color_spec.rb
140
144
  - spec/command/run_command_spec.rb
141
145
  - spec/command/which_spec.rb
146
+ - spec/core_ext/array/list.rb
147
+ - spec/core_ext/hash/list_spec.rb
142
148
  - spec/core_ext/hash/options_spec.rb
143
149
  - spec/core_ext/shellwords/clean_spec.rb
144
150
  - spec/environment_spec.rb
@@ -209,6 +215,8 @@ test_files:
209
215
  - spec/colors/html_color_spec.rb
210
216
  - spec/command/run_command_spec.rb
211
217
  - spec/command/which_spec.rb
218
+ - spec/core_ext/array/list.rb
219
+ - spec/core_ext/hash/list_spec.rb
212
220
  - spec/core_ext/hash/options_spec.rb
213
221
  - spec/core_ext/shellwords/clean_spec.rb
214
222
  - spec/environment_spec.rb