xqsr3 0.33.0.1 → 0.34.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
2
  SHA1:
3
- metadata.gz: 3019cb877ecda9311d4afe377ec6306a7f6876fc
4
- data.tar.gz: 409bb6b065da77c14040ec06744722500db91bee
3
+ metadata.gz: '08b7e3524dc96db46918345f810db795701f4a10'
4
+ data.tar.gz: 05baa4102344c3fc236af32c03a596e592f6537d
5
5
  SHA512:
6
- metadata.gz: a7b02266f7106e8adad0f301114f9bb32f55bbd9f2746b18d9155f30f2ac1bf8975f87070e22c21af3a74ca32e8bd5f7e302920f5109c1531d4bd8553f6ce76a
7
- data.tar.gz: 50517156c5db87de6c786fdc0b7f0d63ce0188cf1d66bfa4a9a9148fae7e9e496ef846e03cfb2ce20b2bc44c1f296913868447326a10bbd2519399619d8cab2c
6
+ metadata.gz: a4be49e79a61c9e44f12de294a1553f1cadc1e089bcda0b8defd567752716cface3e7b25e9a3699b584f305d94e9a5e6b848369a3fb10f6256b7c74f580ecbe0
7
+ data.tar.gz: cf295f1ea20af9bff3ebe1a2e457c4ac2dd4b440dc0a84f9310e5c3980e4994b65ddb17edf533a646cdf7ae18a23fe9ed493fc600e26d833f01cca3d732209a8
@@ -3,3 +3,8 @@ require 'xqsr3/extensions/hash/deep_transform'
3
3
  require 'xqsr3/extensions/hash/has_match'
4
4
  require 'xqsr3/extensions/hash/match'
5
5
 
6
+ unless (RUBY_VERSION.split('.').map { |v| v.to_i } <=> [ 2, 5, 0 ]) > 0
7
+
8
+ require 'xqsr3/extensions/hash/slice'
9
+ end
10
+
@@ -0,0 +1,22 @@
1
+
2
+ unless Hash.instance_methods.include? :slice
3
+
4
+ class Hash
5
+
6
+ def slice(*args)
7
+
8
+ r = {}
9
+
10
+ args.each do |arg|
11
+
12
+ if self.has_key? arg
13
+
14
+ r[arg] = self[arg]
15
+ end
16
+ end
17
+
18
+ r
19
+ end
20
+ end
21
+ end
22
+
@@ -11,9 +11,11 @@ module X_assert_raise_with_message_ # :nodoc: all
11
11
 
12
12
  if TestUnitVersion_.is_at_least? [ 3, 0, 8 ]
13
13
 
14
+ # @!visibility private
14
15
  AssertionFailedError_ = Test::Unit::AssertionFailedError # :nodoc:
15
16
  else
16
17
 
18
+ # @!visibility private
17
19
  class AssertionFailedError_ < ArgumentError; end # :nodoc:
18
20
  end
19
21
 
@@ -5,7 +5,7 @@
5
5
  # Purpose: Adds a writelines() method to the IO module
6
6
  #
7
7
  # Created: 13th April 2007
8
- # Updated: 12th April 2019
8
+ # Updated: 16th April 2019
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/xqsr3
11
11
  #
@@ -56,7 +56,8 @@ module Xqsr3
56
56
  module IO
57
57
 
58
58
  private
59
- module WriteLine_Constants_ #:nodoc:
59
+ # @!visibility private
60
+ module WriteLine_Constants_ #:nodoc: all
60
61
 
61
62
  NUMBER_OF_LINES_TO_EXAMINE = 20
62
63
 
@@ -64,7 +65,9 @@ module IO
64
65
 
65
66
  private
66
67
 
67
- def self.write_to_target_ target, contents, line_separator, column_separator
68
+ # @!visibility private
69
+ def self.write_to_target_ target, contents, line_separator, column_separator # :nodoc:
70
+
68
71
  $stderr.puts "#{self.class}.write_to_target_(target(#{target.class})='#{target}', contents(#{contents.class})='#{contents}', line_separator(#{line_separator.class})='#{line_separator}', column_separator=(#{column_separator.class})='#{column_separator}')" if $DEBUG
69
72
  if contents.instance_of? ::Hash
70
73
 
@@ -87,7 +90,9 @@ $stderr.puts "#{self.class}.write_to_target_(target(#{target.class})='#{target}'
87
90
  # embedded eol, in which case the empty string is returned to force no
88
91
  # (additional) separator will be used. Otherwise, it returns "\n" to
89
92
  # ensure that that is used.
90
- def self.deduce_line_separator_ contents, eol_lookahead_limit
93
+ #
94
+ # @!visibility private
95
+ def self.deduce_line_separator_ contents, eol_lookahead_limit # :nodoc:
91
96
 
92
97
  if contents.instance_of? ::Hash
93
98
 
@@ -193,3 +198,4 @@ end # module Xqsr3
193
198
 
194
199
  # ############################## end of file ############################# #
195
200
 
201
+
@@ -5,7 +5,7 @@
5
5
  # Purpose: Definition of the ParameterChecking module
6
6
  #
7
7
  # Created: 12th February 2015
8
- # Updated: 12th April 2019
8
+ # Updated: 15th April 2019
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/xqsr3
11
11
  #
@@ -59,7 +59,8 @@ module Quality
59
59
  module ParameterChecking
60
60
 
61
61
  private
62
- module Util_ # :nodoc:
62
+ # @!visibility private
63
+ module Util_ # :nodoc: all
63
64
 
64
65
  def self.join_with_or a
65
66
 
@@ -5,7 +5,7 @@
5
5
  # Purpose: Version for Xqsr3 library
6
6
  #
7
7
  # Created: 3rd April 2016
8
- # Updated: 15th April 2019
8
+ # Updated: 4th July 2019
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/xqsr3
11
11
  #
@@ -50,7 +50,7 @@
50
50
  module Xqsr3
51
51
 
52
52
  # Current version of the Xqsr3 library
53
- VERSION = '0.33.0.1'
53
+ VERSION = '0.34.0'
54
54
 
55
55
  private
56
56
  VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '../../../../lib')
4
+
5
+ require 'xqsr3/extensions/hash'
6
+
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '../../../../lib')
4
+
5
+ require 'xqsr3/extensions/hash/slice'
6
+
7
+ class Test_Hash_slice < Test::Unit::TestCase
8
+
9
+ def test_empty
10
+
11
+ assert_equal ({}), ({}.slice())
12
+
13
+ assert_equal ({}), ({}.slice(:abc, 'def'))
14
+ end
15
+
16
+ def test_none_matching
17
+
18
+ assert_equal ({}), ({ abc: 'abc', 'def' => :def }.slice())
19
+ end
20
+
21
+ def test_all_matching
22
+
23
+ assert_equal ({ abc: 'abc', 'def' => :def }), ({ abc: 'abc', 'def' => :def }.slice(:abc, 'def'))
24
+ end
25
+
26
+ def test_some_matching
27
+
28
+ assert_equal ({ abc: 'abc' }), ({ abc: 'abc', 'def' => :def }.slice(:abc, 'ghi'))
29
+ end
30
+ end
31
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xqsr3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.33.0.1
4
+ version: 0.34.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-15 00:00:00.000000000 Z
11
+ date: 2019-07-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  eXtensions by fine Quantum for Standard Ruby and 3rd-party libraries is a
@@ -42,6 +42,7 @@ files:
42
42
  - lib/xqsr3/extensions/hash/deep_transform.rb
43
43
  - lib/xqsr3/extensions/hash/has_match.rb
44
44
  - lib/xqsr3/extensions/hash/match.rb
45
+ - lib/xqsr3/extensions/hash/slice.rb
45
46
  - lib/xqsr3/extensions/io.rb
46
47
  - lib/xqsr3/extensions/io/writelines.rb
47
48
  - lib/xqsr3/extensions/kernel.rb
@@ -102,6 +103,8 @@ files:
102
103
  - test/unit/extensions/enumerable/tc_unique.rb
103
104
  - test/unit/extensions/enumerable/ts_all.rb
104
105
  - test/unit/extensions/hash/tc_deep_transform.rb
106
+ - test/unit/extensions/hash/tc_hash.rb
107
+ - test/unit/extensions/hash/tc_slice.rb
105
108
  - test/unit/extensions/hash/ts_all.rb
106
109
  - test/unit/extensions/io/tc_writelines.rb
107
110
  - test/unit/extensions/io/ts_all.rb