powerpack 0.0.8 → 0.1.3
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 +5 -5
- data/.travis.yml +12 -4
- data/CHANGELOG.md +30 -1
- data/CONTRIBUTING.md +62 -0
- data/README.md +51 -35
- data/lib/powerpack/enumerable/exactly.rb +2 -0
- data/lib/powerpack/enumerable/frequencies.rb +1 -1
- data/lib/powerpack/enumerable/sum.rb +13 -9
- data/lib/powerpack/string.rb +4 -0
- data/lib/powerpack/string/ascii_only.rb +42 -0
- data/lib/powerpack/string/format.rb +1 -1
- data/lib/powerpack/string/remove.rb +17 -0
- data/lib/powerpack/string/remove_prefix.rb +24 -0
- data/lib/powerpack/string/remove_suffix.rb +24 -0
- data/lib/powerpack/version.rb +1 -1
- data/powerpack.gemspec +3 -3
- data/spec/powerpack/enumerable/exactly_spec.rb +8 -8
- data/spec/powerpack/enumerable/several_spec.rb +5 -5
- data/spec/powerpack/enumerable/sum_spec.rb +23 -9
- data/spec/powerpack/numeric/neg_spec.rb +6 -6
- data/spec/powerpack/numeric/pos_spec.rb +6 -6
- data/spec/powerpack/string/ascii_only_spec.rb +45 -0
- data/spec/powerpack/string/blank_spec.rb +3 -3
- data/spec/powerpack/string/remove_prefix_spec.rb +21 -0
- data/spec/powerpack/string/remove_spec.rb +13 -0
- data/spec/powerpack/string/remove_suffix_spec.rb +21 -0
- data/spec/spec_helper.rb +0 -2
- metadata +39 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 466f04d01b789b666492e731d3e25590843994afdcb881537a38937d084d0d45
|
|
4
|
+
data.tar.gz: c926128481ab9eb8fde51b9e4d40346a3f2ea3f1b273e9d92b7de12cab730478
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21383a2e29ce45233f4dadf33ce04452f27b9ed71770995a9796af9d142b251ba3aaab2749a8df921d60283630513dd77c929dcdb81ac1865f7435c941d9bf86
|
|
7
|
+
data.tar.gz: 6542479c6e1f8bb875aa4b1adf8e8cf18c7a7b76b1c5bd0e83659508a343f8baf0e337238141c24d8ad421ab05d4bc9048f4c4f3ae8b658de539a14329ef4cd6
|
data/.travis.yml
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
sudo: false
|
|
1
2
|
language: ruby
|
|
2
3
|
rvm:
|
|
3
|
-
- 1.
|
|
4
|
-
- 2.
|
|
5
|
-
-
|
|
6
|
-
-
|
|
4
|
+
- jruby-9.1.13.0
|
|
5
|
+
- 2.3
|
|
6
|
+
- 2.4
|
|
7
|
+
- 2.5
|
|
8
|
+
- 2.6
|
|
9
|
+
- 2.7
|
|
10
|
+
- ruby-head
|
|
11
|
+
- rbx-3
|
|
7
12
|
script: bundle exec rspec
|
|
13
|
+
matrix:
|
|
14
|
+
allow_failures:
|
|
15
|
+
- rvm: rbx-3
|
data/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
## master (unreleased)
|
|
4
4
|
|
|
5
|
-
## 0.
|
|
5
|
+
## 0.1.3 (2020-11-16)
|
|
6
|
+
|
|
7
|
+
* [#42](https://github.com/bbatsov/powerpack/pull/42): Fix a warning on Ruby 2.7.
|
|
8
|
+
|
|
9
|
+
## 0.1.2 (2018-06-10)
|
|
10
|
+
|
|
11
|
+
* Changed `String#remove_prefix` to return the original string if the parameter is not a prefix.
|
|
12
|
+
* Changed `String#remove_prefix!`to return the original string if the parameter is not a prefix.
|
|
13
|
+
* Changed `String#remove_suffix` to return the original string if the parameter is not a suffix.
|
|
14
|
+
* Changed `String#remove_suffix!` to return the original string if the parameter is not a suffix.
|
|
15
|
+
|
|
16
|
+
## 0.1.1 (2015-05-04)
|
|
17
|
+
|
|
18
|
+
No user-visible changes.
|
|
19
|
+
|
|
20
|
+
## 0.1.0 (2015-01-25)
|
|
21
|
+
|
|
22
|
+
* Added `String#remove_prefix`
|
|
23
|
+
* Added `String#remove_prefix!`
|
|
24
|
+
* Added `String#remove_suffix`
|
|
25
|
+
* Added `String#remove_suffix!`
|
|
26
|
+
|
|
27
|
+
## 0.0.9 (2013-10-22)
|
|
28
|
+
|
|
29
|
+
* Added `String#remove`
|
|
30
|
+
* Added `String#remove!`
|
|
31
|
+
* Added `String#ascii_only`
|
|
32
|
+
* Added `String#ascii_only!`
|
|
33
|
+
|
|
34
|
+
## 0.0.8 (2013-09-13)
|
|
6
35
|
|
|
7
36
|
### New features
|
|
8
37
|
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
If you discover issues, have ideas for improvements or new features,
|
|
4
|
+
please report them to the [issue tracker][1] of the repository or
|
|
5
|
+
submit a pull request. Please, try to follow these guidelines when you
|
|
6
|
+
do so.
|
|
7
|
+
|
|
8
|
+
## Issue reporting
|
|
9
|
+
|
|
10
|
+
* Check that the issue has not already been reported.
|
|
11
|
+
* Check that the issue has not already been fixed in the latest code
|
|
12
|
+
(a.k.a. `master`).
|
|
13
|
+
* Be clear, concise and precise in your description of the problem.
|
|
14
|
+
* Open an issue with a descriptive title and a summary in grammatically correct,
|
|
15
|
+
complete sentences.
|
|
16
|
+
* Include Powerpack's version number.
|
|
17
|
+
* Include any relevant code to the issue summary.
|
|
18
|
+
|
|
19
|
+
## Pull requests
|
|
20
|
+
|
|
21
|
+
* Read [how to properly contribute to open source projects on Github][2].
|
|
22
|
+
* Fork the project.
|
|
23
|
+
* Use a topic/feature branch to easily amend a pull request later, if necessary.
|
|
24
|
+
* Write [good commit messages][3].
|
|
25
|
+
* Use the same coding conventions as the rest of the project.
|
|
26
|
+
* Commit and push until you are happy with your contribution.
|
|
27
|
+
* Make sure to add tests for it. This is important so I don't break it
|
|
28
|
+
in a future version unintentionally.
|
|
29
|
+
* Add an entry to the [Changelog](CHANGELOG.md) accordingly. See [changelog entry format](#changelog-entry-format).
|
|
30
|
+
* Please try not to mess with the Rakefile, version, or history. If
|
|
31
|
+
you want to have your own version, or is otherwise necessary, that
|
|
32
|
+
is fine, but please isolate to its own commit so I can cherry-pick
|
|
33
|
+
around it.
|
|
34
|
+
* Make sure the test suite is passing ([including rbx and jruby][7]) and the code you wrote doesn't produce
|
|
35
|
+
RuboCop offenses.
|
|
36
|
+
* [Squash related commits together][5].
|
|
37
|
+
* Open a [pull request][4] that relates to *only* one subject with a clear title
|
|
38
|
+
and description in grammatically correct, complete sentences.
|
|
39
|
+
|
|
40
|
+
### Changelog entry format
|
|
41
|
+
|
|
42
|
+
Here are a few examples:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
* [#123](https://github.com/bbatsov/powerpack/issues/123): Fixed a bug in `Something#something`. ([@bbatsov][])
|
|
46
|
+
* Added new method `Something#something`. ([@bbatsov][])
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
* Mark it up in [Markdown syntax][6].
|
|
50
|
+
* The entry line should start with `* ` (an asterisk and a space).
|
|
51
|
+
* If the change has a related GitHub issue (e.g. a bug fix for a reported issue), put a link to the issue as `[#123](https://github.com/bbatsov/powerpack/issues/123): `.
|
|
52
|
+
* Describe the brief of the change. The sentence should end with a punctuation.
|
|
53
|
+
* At the end of the entry, add an implicit link to your GitHub user page as `([@username][])`.
|
|
54
|
+
* If this is your first contribution to Powerpack project, add a link definition for the implicit link to the bottom of the changelog as `[@username]: https://github.com/username`.
|
|
55
|
+
|
|
56
|
+
[1]: https://github.com/bbatsov/powerpack/issues
|
|
57
|
+
[2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request
|
|
58
|
+
[3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
|
59
|
+
[4]: https://help.github.com/articles/using-pull-requests
|
|
60
|
+
[5]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
|
|
61
|
+
[6]: http://daringfireball.net/projects/markdown/syntax
|
|
62
|
+
[7]: http://blog.stwrt.ca/2013/09/06/installing-rubinius-with-rbenv
|
data/README.md
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
[](http://badge.fury.io/rb/powerpack)
|
|
2
|
+
[](https://travis-ci.org/bbatsov/powerpack)
|
|
3
3
|
|
|
4
4
|
# Powerpack
|
|
5
5
|
|
|
6
|
-
Powerpack offers some useful extensions to the standard Ruby classes
|
|
6
|
+
Powerpack offers some useful extensions to the standard Ruby classes
|
|
7
|
+
(kind of like `ActiveSupport`, but less ambitious and more modular).
|
|
8
|
+
|
|
9
|
+
The project has several design goals:
|
|
10
|
+
|
|
11
|
+
* **minimalistic** - we don't add every possible extensions, we focus only
|
|
12
|
+
on the stuff that are commonly requested and would be often useful in practice
|
|
13
|
+
* **modular** - all extensions can be loaded individually (often they are just individual methods)
|
|
14
|
+
* **safe** - you can't end up accidentally overriding some existing method definition with Powerpack's extensions
|
|
7
15
|
|
|
8
16
|
## Installation
|
|
9
17
|
|
|
@@ -21,42 +29,50 @@ Or install it yourself as:
|
|
|
21
29
|
|
|
22
30
|
## Extensions
|
|
23
31
|
|
|
24
|
-
* [Array](http://rdoc.info/
|
|
25
|
-
* [#butfirst](http://rdoc.info/
|
|
26
|
-
* [#butlast](http://rdoc.info/
|
|
27
|
-
* [Enumerable](http://rdoc.info/
|
|
28
|
-
* [#average](http://rdoc.info/
|
|
29
|
-
* [#drop_last](http://rdoc.info/
|
|
30
|
-
* [#drop_last_while](http://rdoc.info/
|
|
31
|
-
* [#exactly?](http://rdoc.info/
|
|
32
|
-
* [#frequencies](http://rdoc.info/
|
|
33
|
-
* [#several?](http://rdoc.info/
|
|
34
|
-
* [#sum](http://rdoc.info/
|
|
35
|
-
* [#take_last](http://rdoc.info/
|
|
36
|
-
* [#take_last_while](http://rdoc.info/
|
|
37
|
-
* [Hash](http://rdoc.info/
|
|
38
|
-
* [#symbolize_keys](http://rdoc.info/
|
|
39
|
-
* [Numeric](http://rdoc.info/
|
|
40
|
-
* [#pos?](http://rdoc.info/
|
|
41
|
-
* [#neg?](http://rdoc.info/
|
|
42
|
-
* [#hundred](http://rdoc.info/
|
|
43
|
-
* [#thousand](http://rdoc.info/
|
|
44
|
-
* [#million](http://rdoc.info/
|
|
45
|
-
* [#billion](http://rdoc.info/
|
|
46
|
-
* [#trillion](http://rdoc.info/
|
|
47
|
-
* [#quadrillion](http://rdoc.info/
|
|
48
|
-
* [String](http://rdoc.info/
|
|
49
|
-
* [#
|
|
50
|
-
* [#
|
|
51
|
-
* [#
|
|
52
|
-
* [#
|
|
53
|
-
* [#
|
|
54
|
-
* [#
|
|
32
|
+
* [Array](http://rdoc.info/gems/powerpack/Array)
|
|
33
|
+
* [#butfirst](http://rdoc.info/gems/powerpack/Array#butfirst-instance_method)
|
|
34
|
+
* [#butlast](http://rdoc.info/gems/powerpack/Array#butlast-instance_method)
|
|
35
|
+
* [Enumerable](http://rdoc.info/gems/powerpack/Enumerable)
|
|
36
|
+
* [#average](http://rdoc.info/gems/powerpack/Enumerable#average-instance_method)
|
|
37
|
+
* [#drop_last](http://rdoc.info/gems/powerpack/Enumerable#drop_last-instance_method)
|
|
38
|
+
* [#drop_last_while](http://rdoc.info/gems/powerpack/Enumerable#drop_last_while-instance_method)
|
|
39
|
+
* [#exactly?](http://rdoc.info/gems/powerpack/Enumerable#exactly?-instance_method)
|
|
40
|
+
* [#frequencies](http://rdoc.info/gems/powerpack/Enumerable#frequencies-instance_method)
|
|
41
|
+
* [#several?](http://rdoc.info/gems/powerpack/Enumerable#several?-instance_method)
|
|
42
|
+
* [#sum](http://rdoc.info/gems/powerpack/Enumerable#sum-instance_method)
|
|
43
|
+
* [#take_last](http://rdoc.info/gems/powerpack/Enumerable#take_last-instance_method)
|
|
44
|
+
* [#take_last_while](http://rdoc.info/gems/powerpack/Enumerable#take_last_while-instance_method)
|
|
45
|
+
* [Hash](http://rdoc.info/gems/powerpack/Hash)
|
|
46
|
+
* [#symbolize_keys](http://rdoc.info/gems/powerpack/Hash#symbolize_keys-instance_method)
|
|
47
|
+
* [Numeric](http://rdoc.info/gems/powerpack/Numeric)
|
|
48
|
+
* [#pos?](http://rdoc.info/gems/powerpack/Numeric#pos?-instance_method)
|
|
49
|
+
* [#neg?](http://rdoc.info/gems/powerpack/Numeric#neg?-instance_method)
|
|
50
|
+
* [#hundred](http://rdoc.info/gems/powerpack/Numeric#hundred-instance_method)
|
|
51
|
+
* [#thousand](http://rdoc.info/gems/powerpack/Numeric#thousand-instance_method)
|
|
52
|
+
* [#million](http://rdoc.info/gems/powerpack/Numeric#million-instance_method)
|
|
53
|
+
* [#billion](http://rdoc.info/gems/powerpack/Numeric#billion-instance_method)
|
|
54
|
+
* [#trillion](http://rdoc.info/gems/powerpack/Numeric#trillion-instance_method)
|
|
55
|
+
* [#quadrillion](http://rdoc.info/gems/powerpack/Numeric#quadrillion-instance_method)
|
|
56
|
+
* [String](http://rdoc.info/gems/powerpack/String)
|
|
57
|
+
* [#ascii_only](http://rdoc.info/gems/powerpack/String#ascii_only-instance_method)
|
|
58
|
+
* [#ascii_only!](http://rdoc.info/gems/powerpack/String#ascii_only!-instance_method)
|
|
59
|
+
* [#blank?](http://rdoc.info/gems/powerpack/String#blank?-instance_method)
|
|
60
|
+
* [#format](http://rdoc.info/gems/powerpack/String#format-instance_method)
|
|
61
|
+
* [#remove](http://rdoc.info/gems/powerpack/String#remove-instance_method)
|
|
62
|
+
* [#remove!](http://rdoc.info/gems/powerpack/String#remove!-instance_method)
|
|
63
|
+
* [#remove_prefix](http://rdoc.info/gems/powerpack/String#remove_prefix-instance_method)
|
|
64
|
+
* [#remove_prefix!](http://rdoc.info/gems/powerpack/String#remove_prefix!-instance_method)
|
|
65
|
+
* [#remove_suffix](http://rdoc.info/gems/powerpack/String#remove_suffix-instance_method)
|
|
66
|
+
* [#remove_suffix!](http://rdoc.info/gems/powerpack/String#remove_suffix!-instance_method)
|
|
67
|
+
* [#strip_indent](http://rdoc.info/gems/powerpack/String#strip_indent-instance_method)
|
|
68
|
+
* [#strip_margin](http://rdoc.info/gems/powerpack/String#strip_margin-instance_method)
|
|
69
|
+
* [#squish](http://rdoc.info/gems/powerpack/String#squish-instance_method)
|
|
70
|
+
* [#squish!](http://rdoc.info/gems/powerpack/String#squish!-instance_method)
|
|
55
71
|
|
|
56
72
|
## Documentation
|
|
57
73
|
|
|
58
74
|
A listing of the extensions provided by Powerpack is available
|
|
59
|
-
[here](http://rdoc.info/
|
|
75
|
+
[here](http://rdoc.info/gems/powerpack).
|
|
60
76
|
|
|
61
77
|
## Usage
|
|
62
78
|
|
|
@@ -25,12 +25,14 @@ unless Enumerable.method_defined? :exactly?
|
|
|
25
25
|
each do |*o|
|
|
26
26
|
if yield(*o)
|
|
27
27
|
found_count += 1
|
|
28
|
+
return false if found_count > n
|
|
28
29
|
end
|
|
29
30
|
end
|
|
30
31
|
else
|
|
31
32
|
each do |o|
|
|
32
33
|
if o
|
|
33
34
|
found_count += 1
|
|
35
|
+
return false if found_count > n
|
|
34
36
|
end
|
|
35
37
|
end
|
|
36
38
|
end
|
|
@@ -3,19 +3,23 @@ unless Enumerable.method_defined? :sum
|
|
|
3
3
|
# Sums up elements of a collection by invoking their `+` method.
|
|
4
4
|
# Most useful for summing up numbers.
|
|
5
5
|
#
|
|
6
|
-
# @param
|
|
7
|
-
# It
|
|
8
|
-
# @return The sum of the elements or the
|
|
9
|
-
# elements.
|
|
6
|
+
# @param initial [Object] an optional initial value.
|
|
7
|
+
# It defaults to 0 for an empty collection.
|
|
8
|
+
# @return The sum of the elements, or the initial value if there
|
|
9
|
+
# are no elements.
|
|
10
10
|
#
|
|
11
11
|
# @example
|
|
12
12
|
# [1, 2, 3].sum #=> 6
|
|
13
|
-
# ["a", "b", "c"].sum #=> "abc"
|
|
14
13
|
# [[1], [2], [3]].sum #=> [1, 2, 3]
|
|
15
|
-
# [].sum #=>
|
|
16
|
-
# [].sum
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
# [].sum #=> 0
|
|
15
|
+
# ["a"].sum #=> "a"
|
|
16
|
+
# ["b", "c"].sum("a") #=> "abc"
|
|
17
|
+
def sum(initial = nil)
|
|
18
|
+
if initial
|
|
19
|
+
reduce(initial, &:+)
|
|
20
|
+
else
|
|
21
|
+
reduce(&:+) || 0
|
|
22
|
+
end
|
|
19
23
|
end
|
|
20
24
|
end
|
|
21
25
|
end
|
data/lib/powerpack/string.rb
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
require_relative 'string/ascii_only'
|
|
1
2
|
require_relative 'string/blank'
|
|
2
3
|
require_relative 'string/format'
|
|
4
|
+
require_relative 'string/remove'
|
|
5
|
+
require_relative 'string/remove_prefix'
|
|
6
|
+
require_relative 'string/remove_suffix'
|
|
3
7
|
require_relative 'string/strip_indent'
|
|
4
8
|
require_relative 'string/strip_margin'
|
|
5
9
|
require_relative 'string/squish'
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
class String
|
|
4
|
+
# Return a copy of string with ASCII characters only
|
|
5
|
+
# Source: http://stackoverflow.com/questions/1268289/how-to-get-rid-of-non-ascii-characters-in-ruby
|
|
6
|
+
#
|
|
7
|
+
# @return [String] a copy of string with ASCII characters only
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# 'abc'.ascii_only #=> 'abc'
|
|
11
|
+
#
|
|
12
|
+
# @example
|
|
13
|
+
# '中文123'.ascii_only #=> '123'
|
|
14
|
+
unless String.method_defined? :ascii_only
|
|
15
|
+
def ascii_only
|
|
16
|
+
dup.ascii_only!
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Modify self and keep ASCII characters only
|
|
21
|
+
# Returns the string even if no changes were made.
|
|
22
|
+
# Source: http://stackoverflow.com/questions/1268289/how-to-get-rid-of-non-ascii-characters-in-ruby
|
|
23
|
+
#
|
|
24
|
+
# @return [String] The result string
|
|
25
|
+
#
|
|
26
|
+
# @example
|
|
27
|
+
# 'abc'.ascii_only! #=> 'abc'
|
|
28
|
+
#
|
|
29
|
+
# @example
|
|
30
|
+
# '中文123'.ascii_only! #=> '123'
|
|
31
|
+
unless String.method_defined? :ascii_only!
|
|
32
|
+
def ascii_only!
|
|
33
|
+
encoding_options = {
|
|
34
|
+
:invalid => :replace, # Replace invalid byte sequences
|
|
35
|
+
:undef => :replace, # Replace anything not defined in ASCII
|
|
36
|
+
:replace => '', # Use a blank for those replacements
|
|
37
|
+
:UNIVERSAL_NEWLINE_DECORATOR => true # Always break lines with \n
|
|
38
|
+
}
|
|
39
|
+
self.encode! Encoding.find('ASCII'), **encoding_options
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
unless String.method_defined? :remove
|
|
2
|
+
class String
|
|
3
|
+
# Removes all occurrences of a pattern in a string.
|
|
4
|
+
#
|
|
5
|
+
# @return [String] a new string without any occurrences of the pattern.
|
|
6
|
+
def remove(pattern)
|
|
7
|
+
dup.remove!(pattern)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Removes all occurrences of a pattern in a string.
|
|
11
|
+
#
|
|
12
|
+
# @return [String] the string without any occurrences of the pattern.
|
|
13
|
+
def remove!(pattern)
|
|
14
|
+
gsub!(pattern, '')
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
unless String.method_defined? :remove_prefix
|
|
2
|
+
class String
|
|
3
|
+
# Removes a prefix in a string.
|
|
4
|
+
#
|
|
5
|
+
# @return [String] a new string without the prefix.
|
|
6
|
+
#
|
|
7
|
+
# @example
|
|
8
|
+
# 'Ladies Night'.remove_prefix('Ladies ') #=> 'Night'
|
|
9
|
+
def remove_prefix(pattern)
|
|
10
|
+
dup.remove_prefix!(pattern)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Removes a prefix in a string.
|
|
14
|
+
#
|
|
15
|
+
# @return [String] the string without the prefix.
|
|
16
|
+
#
|
|
17
|
+
# @example
|
|
18
|
+
# 'Ladies Night'.remove_prefix!('Ladies ') #=> 'Night'
|
|
19
|
+
def remove_prefix!(pattern)
|
|
20
|
+
gsub!(/\A#{pattern}/, '')
|
|
21
|
+
self
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
unless String.method_defined? :remove_suffix
|
|
2
|
+
class String
|
|
3
|
+
# Removes a suffix in a string.
|
|
4
|
+
#
|
|
5
|
+
# @return [String] a new string without the suffix.
|
|
6
|
+
#
|
|
7
|
+
# @example
|
|
8
|
+
# 'Ladies Night'.remove_suffix(' Night') #=> 'Ladies'
|
|
9
|
+
def remove_suffix(pattern)
|
|
10
|
+
dup.remove_suffix!(pattern)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Removes a suffix in a string.
|
|
14
|
+
#
|
|
15
|
+
# @return [String] the string without the suffix.
|
|
16
|
+
#
|
|
17
|
+
# @example
|
|
18
|
+
# 'Ladies Night'.remove_suffix!(' Night') #=> 'Ladies'
|
|
19
|
+
def remove_suffix!(pattern)
|
|
20
|
+
gsub!(/#{pattern}\z/, '')
|
|
21
|
+
self
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
data/lib/powerpack/version.rb
CHANGED
data/powerpack.gemspec
CHANGED
|
@@ -17,8 +17,8 @@ Gem::Specification.new do |spec|
|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
18
18
|
spec.require_paths = ['lib']
|
|
19
19
|
|
|
20
|
-
spec.add_development_dependency 'bundler', '
|
|
20
|
+
spec.add_development_dependency 'bundler', '>= 1.3', "< 3.0"
|
|
21
21
|
spec.add_development_dependency 'rake'
|
|
22
|
-
spec.add_development_dependency('rspec'
|
|
23
|
-
spec.add_development_dependency('yard', '~> 0.
|
|
22
|
+
spec.add_development_dependency('rspec')
|
|
23
|
+
spec.add_development_dependency('yard', '~> 0.9')
|
|
24
24
|
end
|
|
@@ -3,37 +3,37 @@ require 'spec_helper'
|
|
|
3
3
|
describe 'Enumerable#exactly' do
|
|
4
4
|
context 'with block' do
|
|
5
5
|
it 'returns true for exact number of matches' do
|
|
6
|
-
expect([1, 2, 3, 4].exactly?(2, &:even?)).to
|
|
6
|
+
expect([1, 2, 3, 4].exactly?(2, &:even?)).to be_truthy
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
it 'returns false for less matches' do
|
|
10
|
-
expect([1, 3, 4].exactly?(2, &:even?)).to
|
|
10
|
+
expect([1, 3, 4].exactly?(2, &:even?)).to be_falsey
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
it 'returns false for more matches' do
|
|
14
|
-
expect([1, 3, 4, 6, 8].exactly?(2, &:even?)).to
|
|
14
|
+
expect([1, 3, 4, 6, 8].exactly?(2, &:even?)).to be_falsey
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
context 'without block' do
|
|
19
19
|
it 'returns true for exact number of non nil/false elements in absence of nil/false elements' do
|
|
20
|
-
expect([1, 2, 3, 4].exactly?(4)).to
|
|
20
|
+
expect([1, 2, 3, 4].exactly?(4)).to be_truthy
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it 'returns true for exact number of non nil/false elements in presence of nil/false elements' do
|
|
24
|
-
expect([1, 2, nil, false].exactly?(2)).to
|
|
24
|
+
expect([1, 2, nil, false].exactly?(2)).to be_truthy
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
it 'returns true for exact number of nil/false elements' do
|
|
28
|
-
expect([nil, false].exactly?(0)).to
|
|
28
|
+
expect([nil, false].exactly?(0)).to be_truthy
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it 'returns false if there are less non nil/false elements in absence of nil/false elements' do
|
|
32
|
-
expect([1, 2, 3].exactly?(4)).to
|
|
32
|
+
expect([1, 2, 3].exactly?(4)).to be_falsey
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
it 'returns false if there are less non nil/false elements in presence of nil/false elements' do
|
|
36
|
-
expect([1, nil, false].exactly?(4)).to
|
|
36
|
+
expect([1, nil, false].exactly?(4)).to be_falsey
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -3,25 +3,25 @@ require 'spec_helper'
|
|
|
3
3
|
describe 'Enumerable#several' do
|
|
4
4
|
context 'with block' do
|
|
5
5
|
it 'returns true if more than 1 element matches the predicate' do
|
|
6
|
-
expect([1, 2, 3, 4].several?(&:even?)).to
|
|
6
|
+
expect([1, 2, 3, 4].several?(&:even?)).to be_truthy
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
it 'returns false if just 1 element matches the predicate' do
|
|
10
|
-
expect([1, 3, 4].several?(&:even?)).to
|
|
10
|
+
expect([1, 3, 4].several?(&:even?)).to be_falsey
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
it 'returns false if no elements match the predicate' do
|
|
14
|
-
expect([1, 3, 4].several?(&:even?)).to
|
|
14
|
+
expect([1, 3, 4].several?(&:even?)).to be_falsey
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
context 'without block' do
|
|
19
19
|
it 'returns true if there are 2 or more non nil/false elements' do
|
|
20
|
-
expect([1, 2, 3, 4].several?).to
|
|
20
|
+
expect([1, 2, 3, 4].several?).to be_truthy
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it 'returns false if there are less than 2 non nil/false elements' do
|
|
24
|
-
expect([1, nil, false].several?).to
|
|
24
|
+
expect([1, nil, false].several?).to be_falsey
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
end
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
unless Enumerable.method_defined? :sum
|
|
4
|
+
describe 'Enumerable#sum' do
|
|
5
|
+
it 'sums up the numbers of an enum' do
|
|
6
|
+
expect((1..3).sum).to eq(6)
|
|
7
|
+
end
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
it 'returns zero when invoked on an empty collection' do
|
|
10
|
+
expect([].sum).to be_zero
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'returns the initial value when invoked on an empty collection' do
|
|
14
|
+
expect([].sum('')).to be_empty
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'prepends the initial value to the sum' do
|
|
18
|
+
expect(['b', 'c'].sum('a')).to eq('abc')
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'concatenates strings' do
|
|
22
|
+
expect(['a', 'b', 'c'].sum).to eq('abc')
|
|
23
|
+
end
|
|
11
24
|
|
|
12
|
-
|
|
13
|
-
|
|
25
|
+
it 'concatenates arrays' do
|
|
26
|
+
expect([[1], [2], [3]].sum).to eq([1, 2, 3])
|
|
27
|
+
end
|
|
14
28
|
end
|
|
15
29
|
end
|
|
@@ -2,23 +2,23 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe 'Numeric#neg?' do
|
|
4
4
|
it 'returns false for positive integer' do
|
|
5
|
-
expect(1.neg?).to
|
|
5
|
+
expect(1.neg?).to be_falsey
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
it 'returns false for positive float' do
|
|
9
|
-
expect(0.1.neg?).to
|
|
9
|
+
expect(0.1.neg?).to be_falsey
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it 'returns true for negative integer' do
|
|
13
|
-
expect(-1.neg?).to
|
|
13
|
+
expect(-1.neg?).to be_truthy
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
it 'returns true for negative float' do
|
|
17
|
-
expect(-0.01.neg?).to
|
|
17
|
+
expect(-0.01.neg?).to be_truthy
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it 'returns false for 0' do
|
|
21
|
-
expect(0.neg?).to
|
|
22
|
-
expect(0.0.neg?).to
|
|
21
|
+
expect(0.neg?).to be_falsey
|
|
22
|
+
expect(0.0.neg?).to be_falsey
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -2,23 +2,23 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe 'Numeric#pos?' do
|
|
4
4
|
it 'returns true for positive integer' do
|
|
5
|
-
expect(1.pos?).to
|
|
5
|
+
expect(1.pos?).to be_truthy
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
it 'returns true for positive float' do
|
|
9
|
-
expect(0.1.pos?).to
|
|
9
|
+
expect(0.1.pos?).to be_truthy
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it 'returns false for negative integer' do
|
|
13
|
-
expect(-1.pos?).to
|
|
13
|
+
expect(-1.pos?).to be_falsey
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
it 'returns false for negative float' do
|
|
17
|
-
expect(-0.01.pos?).to
|
|
17
|
+
expect(-0.01.pos?).to be_falsey
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it 'returns false for 0' do
|
|
21
|
-
expect(0.pos?).to
|
|
22
|
-
expect(0.0.pos?).to
|
|
21
|
+
expect(0.pos?).to be_falsey
|
|
22
|
+
expect(0.0.pos?).to be_falsey
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
unless defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
|
6
|
+
describe 'String#ascii_only' do
|
|
7
|
+
it 'returns same value for string with ASCII chars only' do
|
|
8
|
+
expect('abc'.ascii_only).to eq 'abc'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'returns string without non-ASCII chars' do
|
|
12
|
+
expect("abc\u{6666}".force_encoding("UTF-8").ascii_only).to eq 'abc'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'returns string without non-ASCII chars and with ASCII chars' do
|
|
16
|
+
expect("\u{6666}".force_encoding("UTF-8").ascii_only).to eq ''
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'does not change the original string' do
|
|
20
|
+
string = "abc\u{6666}".force_encoding("UTF-8")
|
|
21
|
+
string.ascii_only
|
|
22
|
+
expect(string).to eq "abc\u{6666}".force_encoding("UTF-8")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe 'String#ascii_only!' do
|
|
27
|
+
it 'returns same value for string with ASCII chars only' do
|
|
28
|
+
expect('abc'.ascii_only!).to eq 'abc'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'returns string without non-ASCII chars' do
|
|
32
|
+
expect("abc\u{6666}".force_encoding("UTF-8").ascii_only!).to eq 'abc'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'returns string without non-ASCII chars and with ASCII chars' do
|
|
36
|
+
expect("\u{6666}".force_encoding("UTF-8").ascii_only!).to eq ''
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'changes the original string' do
|
|
40
|
+
string = "abc\u{6666}".force_encoding("UTF-8")
|
|
41
|
+
string.ascii_only!
|
|
42
|
+
expect(string).to eq 'abc'
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -2,14 +2,14 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe 'String#blank?' do
|
|
4
4
|
it 'returns true for an empty string' do
|
|
5
|
-
expect(''.blank?).to
|
|
5
|
+
expect(''.blank?).to be_truthy
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
it 'returns true for a string with only whitespace in it' do
|
|
9
|
-
expect(' '.blank?).to
|
|
9
|
+
expect(' '.blank?).to be_truthy
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it 'returns false for a string with non-whitespace chars in it' do
|
|
13
|
-
expect(' test'.blank?).to
|
|
13
|
+
expect(' test'.blank?).to be_falsey
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'String#remove_prefix' do
|
|
4
|
+
it 'removes a prefix in a string' do
|
|
5
|
+
expect('Ladies Night'.remove_prefix('Ladies ')).to eq('Night')
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it 'returns the original string if the parameter is not a prefix' do
|
|
9
|
+
expect('Ladies Night'.remove_prefix('Night')).to eq('Ladies Night')
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe 'String#remove_prefix!' do
|
|
14
|
+
it 'removes a prefix in a string' do
|
|
15
|
+
expect('Ladies Night'.remove_prefix!('Ladies ')).to eq('Night')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'returns the original string if the parameter is not a prefix' do
|
|
19
|
+
expect('Ladies Night'.remove_prefix!('Night')).to eq('Ladies Night')
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'String#remove' do
|
|
4
|
+
it 'removes all occurrences of a pattern' do
|
|
5
|
+
expect('Ladies Night'.remove(/Ladies /)).to eq('Night')
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe 'String#remove!' do
|
|
10
|
+
it 'removes all occurrences of a pattern' do
|
|
11
|
+
expect('Ladies Night'.remove(/Ladies /)).to eq('Night')
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'String#remove_suffix' do
|
|
4
|
+
it 'removes a suffix in a string' do
|
|
5
|
+
expect('Ladies Night'.remove_suffix(' Night')).to eq('Ladies')
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it 'returns the original string if the parameter is not a suffix' do
|
|
9
|
+
expect('Ladies Night'.remove_suffix('Ladies')).to eq('Ladies Night')
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe 'String#remove_suffix!' do
|
|
14
|
+
it 'removes a suffix in a string' do
|
|
15
|
+
expect('Ladies Night'.remove_suffix!(' Night')).to eq('Ladies')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'returns the original string if the parameter is not a suffix' do
|
|
19
|
+
expect('Ladies Night'.remove_suffix!('Ladies')).to eq('Ladies Night')
|
|
20
|
+
end
|
|
21
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,71 +1,77 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: powerpack
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bozhidar Batsov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-11-16 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.3'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '3.0'
|
|
20
23
|
type: :development
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
24
|
-
- -
|
|
27
|
+
- - ">="
|
|
25
28
|
- !ruby/object:Gem::Version
|
|
26
29
|
version: '1.3'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '3.0'
|
|
27
33
|
- !ruby/object:Gem::Dependency
|
|
28
34
|
name: rake
|
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
|
30
36
|
requirements:
|
|
31
|
-
- -
|
|
37
|
+
- - ">="
|
|
32
38
|
- !ruby/object:Gem::Version
|
|
33
39
|
version: '0'
|
|
34
40
|
type: :development
|
|
35
41
|
prerelease: false
|
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
43
|
requirements:
|
|
38
|
-
- -
|
|
44
|
+
- - ">="
|
|
39
45
|
- !ruby/object:Gem::Version
|
|
40
46
|
version: '0'
|
|
41
47
|
- !ruby/object:Gem::Dependency
|
|
42
48
|
name: rspec
|
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
|
44
50
|
requirements:
|
|
45
|
-
- -
|
|
51
|
+
- - ">="
|
|
46
52
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
53
|
+
version: '0'
|
|
48
54
|
type: :development
|
|
49
55
|
prerelease: false
|
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
57
|
requirements:
|
|
52
|
-
- -
|
|
58
|
+
- - ">="
|
|
53
59
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
60
|
+
version: '0'
|
|
55
61
|
- !ruby/object:Gem::Dependency
|
|
56
62
|
name: yard
|
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
|
58
64
|
requirements:
|
|
59
|
-
- - ~>
|
|
65
|
+
- - "~>"
|
|
60
66
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0.
|
|
67
|
+
version: '0.9'
|
|
62
68
|
type: :development
|
|
63
69
|
prerelease: false
|
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
71
|
requirements:
|
|
66
|
-
- - ~>
|
|
72
|
+
- - "~>"
|
|
67
73
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0.
|
|
74
|
+
version: '0.9'
|
|
69
75
|
description: A few useful extensions to core Ruby classes.
|
|
70
76
|
email:
|
|
71
77
|
- bozhidar@batsov.com
|
|
@@ -73,10 +79,11 @@ executables: []
|
|
|
73
79
|
extensions: []
|
|
74
80
|
extra_rdoc_files: []
|
|
75
81
|
files:
|
|
76
|
-
- .gitignore
|
|
77
|
-
- .rspec
|
|
78
|
-
- .travis.yml
|
|
82
|
+
- ".gitignore"
|
|
83
|
+
- ".rspec"
|
|
84
|
+
- ".travis.yml"
|
|
79
85
|
- CHANGELOG.md
|
|
86
|
+
- CONTRIBUTING.md
|
|
80
87
|
- Gemfile
|
|
81
88
|
- LICENSE.txt
|
|
82
89
|
- README.md
|
|
@@ -102,8 +109,12 @@ files:
|
|
|
102
109
|
- lib/powerpack/numeric/pos.rb
|
|
103
110
|
- lib/powerpack/numeric/scale.rb
|
|
104
111
|
- lib/powerpack/string.rb
|
|
112
|
+
- lib/powerpack/string/ascii_only.rb
|
|
105
113
|
- lib/powerpack/string/blank.rb
|
|
106
114
|
- lib/powerpack/string/format.rb
|
|
115
|
+
- lib/powerpack/string/remove.rb
|
|
116
|
+
- lib/powerpack/string/remove_prefix.rb
|
|
117
|
+
- lib/powerpack/string/remove_suffix.rb
|
|
107
118
|
- lib/powerpack/string/squish.rb
|
|
108
119
|
- lib/powerpack/string/strip_indent.rb
|
|
109
120
|
- lib/powerpack/string/strip_margin.rb
|
|
@@ -124,8 +135,12 @@ files:
|
|
|
124
135
|
- spec/powerpack/numeric/neg_spec.rb
|
|
125
136
|
- spec/powerpack/numeric/pos_spec.rb
|
|
126
137
|
- spec/powerpack/numeric/scale_spec.rb
|
|
138
|
+
- spec/powerpack/string/ascii_only_spec.rb
|
|
127
139
|
- spec/powerpack/string/blank_spec.rb
|
|
128
140
|
- spec/powerpack/string/format_spec.rb
|
|
141
|
+
- spec/powerpack/string/remove_prefix_spec.rb
|
|
142
|
+
- spec/powerpack/string/remove_spec.rb
|
|
143
|
+
- spec/powerpack/string/remove_suffix_spec.rb
|
|
129
144
|
- spec/powerpack/string/squish_spec.rb
|
|
130
145
|
- spec/powerpack/string/strip_indent_spec.rb
|
|
131
146
|
- spec/powerpack/string/strip_margin_spec.rb
|
|
@@ -140,17 +155,16 @@ require_paths:
|
|
|
140
155
|
- lib
|
|
141
156
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
157
|
requirements:
|
|
143
|
-
- -
|
|
158
|
+
- - ">="
|
|
144
159
|
- !ruby/object:Gem::Version
|
|
145
160
|
version: '0'
|
|
146
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
162
|
requirements:
|
|
148
|
-
- -
|
|
163
|
+
- - ">="
|
|
149
164
|
- !ruby/object:Gem::Version
|
|
150
165
|
version: '0'
|
|
151
166
|
requirements: []
|
|
152
|
-
|
|
153
|
-
rubygems_version: 2.0.3
|
|
167
|
+
rubygems_version: 3.1.2
|
|
154
168
|
signing_key:
|
|
155
169
|
specification_version: 4
|
|
156
170
|
summary: A few useful extensions to core Ruby classes.
|
|
@@ -170,10 +184,13 @@ test_files:
|
|
|
170
184
|
- spec/powerpack/numeric/neg_spec.rb
|
|
171
185
|
- spec/powerpack/numeric/pos_spec.rb
|
|
172
186
|
- spec/powerpack/numeric/scale_spec.rb
|
|
187
|
+
- spec/powerpack/string/ascii_only_spec.rb
|
|
173
188
|
- spec/powerpack/string/blank_spec.rb
|
|
174
189
|
- spec/powerpack/string/format_spec.rb
|
|
190
|
+
- spec/powerpack/string/remove_prefix_spec.rb
|
|
191
|
+
- spec/powerpack/string/remove_spec.rb
|
|
192
|
+
- spec/powerpack/string/remove_suffix_spec.rb
|
|
175
193
|
- spec/powerpack/string/squish_spec.rb
|
|
176
194
|
- spec/powerpack/string/strip_indent_spec.rb
|
|
177
195
|
- spec/powerpack/string/strip_margin_spec.rb
|
|
178
196
|
- spec/spec_helper.rb
|
|
179
|
-
has_rdoc:
|