more_core_extensions 1.2.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 +7 -0
- data/.rspec +2 -1
- data/README.md +5 -5
- data/lib/more_core_extensions/core_ext/array/deletes.rb +2 -1
- data/lib/more_core_extensions/core_ext/array/duplicates.rb +1 -1
- data/lib/more_core_extensions/core_ext/array/element_counts.rb +8 -2
- data/lib/more_core_extensions/core_ext/array/inclusions.rb +3 -0
- data/lib/more_core_extensions/core_ext/hash/deletes.rb +1 -0
- data/lib/more_core_extensions/core_ext/object/namespace.rb +1 -9
- data/lib/more_core_extensions/version.rb +1 -1
- data/spec/core_ext/array/deletes_spec.rb +9 -11
- data/spec/core_ext/array/duplicates_spec.rb +4 -6
- data/spec/core_ext/array/element_counts_spec.rb +13 -7
- data/spec/core_ext/array/inclusions_spec.rb +35 -25
- data/spec/core_ext/array/nested_spec.rb +61 -63
- data/spec/core_ext/array/random_spec.rb +8 -10
- data/spec/core_ext/array/stretch_spec.rb +9 -11
- data/spec/core_ext/array/tableize_spec.rb +23 -25
- data/spec/core_ext/hash/deletes_spec.rb +8 -10
- data/spec/core_ext/hash/nested_spec.rb +63 -64
- data/spec/core_ext/object/namespace_spec.rb +4 -20
- data/spec/core_ext/string/formats_spec.rb +46 -48
- data/spec/core_ext/string/hex_dump_spec.rb +12 -14
- data/spec/spec_helper.rb +70 -6
- metadata +22 -44
- data/.gitignore +0 -17
- data/.travis.yml +0 -4
- data/Gemfile +0 -4
- data/Rakefile +0 -6
- data/more_core_extensions.gemspec +0 -27
@@ -1,25 +1,23 @@
|
|
1
|
-
require_relative "../../spec_helper"
|
2
|
-
|
3
1
|
describe String do
|
4
2
|
context '#hex_dump' do
|
5
3
|
let(:str) { "This is a test of the emergency broadcast system. This is only a test." }
|
6
4
|
|
7
5
|
it "will handle exceptions" do
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
expect { "".hex_dump(1, 2) }.to raise_error(ArgumentError)
|
7
|
+
expect { "".hex_dump(:obj => STDOUT) }.to raise_error(ArgumentError)
|
8
|
+
expect { "".hex_dump(:meth => :puts) }.to raise_error(ArgumentError)
|
11
9
|
end
|
12
10
|
|
13
11
|
it 'with empty string' do
|
14
|
-
"".hex_dump.
|
12
|
+
expect("".hex_dump).to eq("")
|
15
13
|
end
|
16
14
|
|
17
15
|
it 'with a short string' do
|
18
|
-
"This is a test.".hex_dump.
|
16
|
+
expect("This is a test.".hex_dump).to eq("0x00000000 54 68 69 73 20 69 73 20 61 20 74 65 73 74 2e This is a test.\n")
|
19
17
|
end
|
20
18
|
|
21
19
|
it 'normal dump' do
|
22
|
-
str.hex_dump.
|
20
|
+
expect(str.hex_dump).to eq <<-EOL
|
23
21
|
0x00000000 54 68 69 73 20 69 73 20 61 20 74 65 73 74 20 6f This is a test o
|
24
22
|
0x00000010 66 20 74 68 65 20 65 6d 65 72 67 65 6e 63 79 20 f the emergency\040
|
25
23
|
0x00000020 62 72 6f 61 64 63 61 73 74 20 73 79 73 74 65 6d broadcast system
|
@@ -31,7 +29,7 @@ EOL
|
|
31
29
|
it 'passing object and method' do
|
32
30
|
str_out = ''
|
33
31
|
str.hex_dump(:obj => str_out, :meth => :<<)
|
34
|
-
str_out.
|
32
|
+
expect(str_out).to eq <<-EOL
|
35
33
|
0x00000000 54 68 69 73 20 69 73 20 61 20 74 65 73 74 20 6f This is a test o
|
36
34
|
0x00000010 66 20 74 68 65 20 65 6d 65 72 67 65 6e 63 79 20 f the emergency\040
|
37
35
|
0x00000020 62 72 6f 61 64 63 61 73 74 20 73 79 73 74 65 6d broadcast system
|
@@ -41,7 +39,7 @@ EOL
|
|
41
39
|
end
|
42
40
|
|
43
41
|
it 'passing :grouping => 8 option' do
|
44
|
-
str.hex_dump(:grouping => 8).
|
42
|
+
expect(str.hex_dump(:grouping => 8)).to eq <<-EOL
|
45
43
|
0x00000000 54 68 69 73 20 69 73 20 This is\040
|
46
44
|
0x00000008 61 20 74 65 73 74 20 6f a test o
|
47
45
|
0x00000010 66 20 74 68 65 20 65 6d f the em
|
@@ -55,11 +53,11 @@ EOL
|
|
55
53
|
end
|
56
54
|
|
57
55
|
it 'passing :newline => false option' do
|
58
|
-
str.hex_dump(:newline => false).
|
56
|
+
expect(str.hex_dump(:newline => false)).to eq("0x00000000 54 68 69 73 20 69 73 20 61 20 74 65 73 74 20 6f This is a test o0x00000010 66 20 74 68 65 20 65 6d 65 72 67 65 6e 63 79 20 f the emergency 0x00000020 62 72 6f 61 64 63 61 73 74 20 73 79 73 74 65 6d broadcast system0x00000030 2e 20 54 68 69 73 20 69 73 20 6f 6e 6c 79 20 61 . This is only a0x00000040 20 74 65 73 74 2e test.")
|
59
57
|
end
|
60
58
|
|
61
59
|
it 'dumping every possible character' do
|
62
|
-
expected = <<-EOL
|
60
|
+
expected = (<<-EOL).force_encoding("ASCII-8BIT")
|
63
61
|
0x00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................
|
64
62
|
0x00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ................
|
65
63
|
0x00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f !\"\#$%&'()*+,-./
|
@@ -80,7 +78,7 @@ EOL
|
|
80
78
|
|
81
79
|
str = ''
|
82
80
|
0.upto(255) { |i| str << i.chr }
|
83
|
-
str.hex_dump.
|
81
|
+
expect(str.hex_dump).to eq(expected)
|
84
82
|
end
|
85
83
|
end
|
86
|
-
end
|
84
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,21 +1,85 @@
|
|
1
1
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
2
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
-
#
|
4
|
-
# loaded
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, make a
|
10
|
+
# separate helper file that requires this one and then use it only in the specs
|
11
|
+
# that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
5
15
|
#
|
6
16
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
17
|
RSpec.configure do |config|
|
8
|
-
|
18
|
+
# The settings below are suggested to provide a good initial experience
|
19
|
+
# with RSpec, but feel free to customize to your heart's content.
|
20
|
+
|
21
|
+
# These two settings work together to allow you to limit a spec run
|
22
|
+
# to individual examples or groups you care about by tagging them with
|
23
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
24
|
+
# get run.
|
25
|
+
config.filter_run :focus
|
9
26
|
config.run_all_when_everything_filtered = true
|
10
27
|
|
28
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
29
|
+
# file, and it's useful to allow more verbose output when running an
|
30
|
+
# individual spec file.
|
31
|
+
if config.files_to_run.one?
|
32
|
+
# Use the documentation formatter for detailed output,
|
33
|
+
# unless a formatter has already been configured
|
34
|
+
# (e.g. via a command-line flag).
|
35
|
+
config.default_formatter = 'doc'
|
36
|
+
end
|
37
|
+
|
38
|
+
# Print the 10 slowest examples and example groups at the
|
39
|
+
# end of the spec run, to help surface which specs are running
|
40
|
+
# particularly slow.
|
41
|
+
# config.profile_examples = 10
|
42
|
+
|
11
43
|
# Run specs in random order to surface order dependencies. If you find an
|
12
44
|
# order dependency and want to debug it, you can fix the order by providing
|
13
45
|
# the seed, which is printed after each run.
|
14
46
|
# --seed 1234
|
15
|
-
config.order =
|
47
|
+
config.order = :random
|
48
|
+
|
49
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
50
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
51
|
+
# test failures related to randomization by passing the same `--seed` value
|
52
|
+
# as the one that triggered the failure.
|
53
|
+
Kernel.srand config.seed
|
54
|
+
|
55
|
+
# rspec-expectations config goes here. You can use an alternate
|
56
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
57
|
+
# assertions if you prefer.
|
58
|
+
config.expect_with :rspec do |expectations|
|
59
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
60
|
+
# For more details, see:
|
61
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
62
|
+
expectations.syntax = :expect
|
63
|
+
end
|
64
|
+
|
65
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
66
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
67
|
+
config.mock_with :rspec do |mocks|
|
68
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
69
|
+
# For more details, see:
|
70
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
71
|
+
mocks.syntax = :expect
|
72
|
+
|
73
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
74
|
+
# a real object. This is generally recommended.
|
75
|
+
mocks.verify_partial_doubles = true
|
76
|
+
end
|
16
77
|
end
|
17
78
|
|
18
|
-
|
19
|
-
|
79
|
+
begin
|
80
|
+
require 'coveralls'
|
81
|
+
Coveralls.wear!
|
82
|
+
rescue LoadError
|
83
|
+
end
|
20
84
|
|
21
85
|
require 'more_core_extensions/all'
|
metadata
CHANGED
@@ -1,94 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: more_core_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jason Frey
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.3'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.3'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: coveralls
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ">="
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
61
|
+
version: '3.0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - ">="
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
68
|
+
version: '3.0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: activesupport
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ">"
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '3.2'
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ">"
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '3.2'
|
94
83
|
description: MoreCoreExtensions are a set of core extensions beyond those provided
|
@@ -99,13 +88,9 @@ executables: []
|
|
99
88
|
extensions: []
|
100
89
|
extra_rdoc_files: []
|
101
90
|
files:
|
102
|
-
- .
|
103
|
-
- .rspec
|
104
|
-
- .travis.yml
|
105
|
-
- Gemfile
|
91
|
+
- ".rspec"
|
106
92
|
- LICENSE.txt
|
107
93
|
- README.md
|
108
|
-
- Rakefile
|
109
94
|
- lib/more_core_extensions.rb
|
110
95
|
- lib/more_core_extensions/all.rb
|
111
96
|
- lib/more_core_extensions/core_ext/array.rb
|
@@ -129,7 +114,6 @@ files:
|
|
129
114
|
- lib/more_core_extensions/core_ext/string/formats.rb
|
130
115
|
- lib/more_core_extensions/core_ext/string/hex_dump.rb
|
131
116
|
- lib/more_core_extensions/version.rb
|
132
|
-
- more_core_extensions.gemspec
|
133
117
|
- spec/core_ext/array/deletes_spec.rb
|
134
118
|
- spec/core_ext/array/duplicates_spec.rb
|
135
119
|
- spec/core_ext/array/element_counts_spec.rb
|
@@ -147,33 +131,26 @@ files:
|
|
147
131
|
homepage: http://github.com/ManageIQ/more_core_extensions
|
148
132
|
licenses:
|
149
133
|
- MIT
|
134
|
+
metadata: {}
|
150
135
|
post_install_message:
|
151
136
|
rdoc_options: []
|
152
137
|
require_paths:
|
153
138
|
- lib
|
154
139
|
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
140
|
requirements:
|
157
|
-
- -
|
141
|
+
- - ">="
|
158
142
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
160
|
-
segments:
|
161
|
-
- 0
|
162
|
-
hash: -2354551733193230348
|
143
|
+
version: 1.9.3
|
163
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
-
none: false
|
165
145
|
requirements:
|
166
|
-
- -
|
146
|
+
- - ">="
|
167
147
|
- !ruby/object:Gem::Version
|
168
148
|
version: '0'
|
169
|
-
segments:
|
170
|
-
- 0
|
171
|
-
hash: -2354551733193230348
|
172
149
|
requirements: []
|
173
150
|
rubyforge_project:
|
174
|
-
rubygems_version:
|
151
|
+
rubygems_version: 2.4.8
|
175
152
|
signing_key:
|
176
|
-
specification_version:
|
153
|
+
specification_version: 4
|
177
154
|
summary: MoreCoreExtensions are a set of core extensions beyond those provided by
|
178
155
|
ActiveSupport.
|
179
156
|
test_files:
|
@@ -191,3 +168,4 @@ test_files:
|
|
191
168
|
- spec/core_ext/string/formats_spec.rb
|
192
169
|
- spec/core_ext/string/hex_dump_spec.rb
|
193
170
|
- spec/spec_helper.rb
|
171
|
+
- ".rspec"
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'more_core_extensions/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "more_core_extensions"
|
8
|
-
spec.version = MoreCoreExtensions::VERSION
|
9
|
-
spec.authors = ["Jason Frey"]
|
10
|
-
spec.email = ["fryguy9@gmail.com"]
|
11
|
-
spec.description = %q{MoreCoreExtensions are a set of core extensions beyond those provided by ActiveSupport.}
|
12
|
-
spec.summary = spec.description
|
13
|
-
spec.homepage = "http://github.com/ManageIQ/more_core_extensions"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files`.split($/)
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
-
spec.add_development_dependency "coveralls"
|
23
|
-
spec.add_development_dependency "rake"
|
24
|
-
spec.add_development_dependency "rspec"
|
25
|
-
|
26
|
-
spec.add_dependency "activesupport", "> 3.2"
|
27
|
-
end
|