finishing_moves 0.20 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -5
- data/README.md +8 -8
- data/Vagrantfile +2 -2
- data/finishing_moves.gemspec +2 -5
- data/lib/finishing_moves/array.rb +26 -5
- data/lib/finishing_moves/hash.rb +5 -7
- data/lib/finishing_moves/string.rb +11 -0
- data/lib/finishing_moves/version.rb +1 -1
- data/provision.sh +12 -3
- data/spec/array_spec.rb +26 -0
- data/spec/hash_spec.rb +14 -0
- data/spec/spec_helper.rb +0 -4
- data/spec/string_spec.rb +280 -259
- metadata +13 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a791dce174d28e7ddf84f7a277f928ad75e5fafe2077d0be9f7650fb05cd56ab
|
4
|
+
data.tar.gz: 85b42fa2e461a88cb3a3a733422b27907ed1a17fedfdb8473f27afc6206c3404
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54f153a89bbdbc16aaaae04f935b2a405b15e8a61885ab509558212010dff1775d2a6957628f9faddd65a03134b0308ce1cb1a3a59a123dda616145415dcde1d
|
7
|
+
data.tar.gz: d21e8d643d14e507714d95f622c3a95bb61d5c31f4f6549ae52dfb249041e324beed6aeff0eedd49da2bf86a8becb9ee64d4cffbd4dab43689ef214b7d49e476
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Finishing Moves
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/finishing_moves.svg)](https://rubygems.org/gems/finishing_moves)
|
3
3
|
[![Build Status](https://travis-ci.org/forgecrafted/finishing_moves.svg?branch=master)](https://travis-ci.org/forgecrafted/finishing_moves)
|
4
|
-
[![
|
4
|
+
[![Mentioned in Awesome Ruby](https://awesome.re/mentioned-badge.svg)](https://github.com/markets/awesome-ruby)
|
5
5
|
|
6
6
|
Ruby includes a huge amount of default awesomeness that tackles most common development challenges. But every now and then, you find yourself performing contortions to achieve results that, honestly, **should feel more natural** given the language's design elegance. Finishing Moves is a collection of methods designed to assist in those "why is this awkward?" scenarios.
|
7
7
|
|
@@ -26,6 +26,8 @@ gem install 'finishing_moves'
|
|
26
26
|
- [`Array#to_hash_values`](https://github.com/forgecrafted/finishing_moves/wiki/Array#arrayto_hash_values) :boom:
|
27
27
|
- [`Array#to_indexed_hash`](https://github.com/forgecrafted/finishing_moves/wiki/Array#arrayto_indexed_hash)
|
28
28
|
- [`Array#to_hash_keys`](https://github.com/forgecrafted/finishing_moves/wiki/Array#arrayto_hash_keys)
|
29
|
+
- [`Array#to_sym_strict`](https://github.com/forgecrafted/finishing_moves/wiki/Array#arrayto_sym_strict)
|
30
|
+
- [`Array#to_sym_loose`](https://github.com/forgecrafted/finishing_moves/wiki/Array#arrayto_sym_loose)
|
29
31
|
- [`Enumerable#key_map`](https://github.com/forgecrafted/finishing_moves/wiki/Enumerable#enumerablekey_map) :boom:
|
30
32
|
- [`Enumerable#key_map_reduce`](https://github.com/forgecrafted/finishing_moves/wiki/Enumerable#enumerablekey_map_reduce)
|
31
33
|
- [`Hash#delete!`](https://github.com/forgecrafted/finishing_moves/wiki/Hash#hashdelete)
|
@@ -33,6 +35,8 @@ gem install 'finishing_moves'
|
|
33
35
|
- [`Hash#delete_each!`](https://github.com/forgecrafted/finishing_moves/wiki/Hash#hashdelete_each-1)
|
34
36
|
- [`Integer#length`](https://github.com/forgecrafted/finishing_moves/wiki/Numeric#integerlength)
|
35
37
|
- [`Kernel#nil_chain`](https://github.com/forgecrafted/finishing_moves/wiki/Kernel#kernelnil_chain) :boom::boom:
|
38
|
+
- [`Kernel#bool_chain`](https://github.com/forgecrafted/finishing_moves/wiki/Kernel#kernelbool_chain)
|
39
|
+
- [`Kernel#silently`](https://github.com/forgecrafted/finishing_moves/wiki/Kernel#kernelsilently)
|
36
40
|
- [`Kernel#cascade`](https://github.com/forgecrafted/finishing_moves/wiki/Kernel#kernelcascade)
|
37
41
|
- [`Kernel#class_exists?`](https://github.com/forgecrafted/finishing_moves/wiki/Kernel#kernelclass_exists)
|
38
42
|
- [`Numeric#add_percent`](https://github.com/forgecrafted/finishing_moves/wiki/Numeric#numericadd_percent)
|
@@ -57,15 +61,12 @@ gem install 'finishing_moves'
|
|
57
61
|
- [`String#remove_whitespace`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringremove_whitespace)
|
58
62
|
- [`String#replace_whitespace`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringreplace_whitespace)
|
59
63
|
- [`String#strip_all`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringstrip_all) :boom:
|
60
|
-
|
61
|
-
*
|
62
|
-
|
63
|
-
- ~Fiscal Calendar Calculations~ Moved to its own gem! [Check out Fiscally.](https://github.com/forgecrafted/fiscally)
|
64
|
-
- [Boolean Typecasting](https://github.com/forgecrafted/finishing_moves/wiki/Boolean-Typecasting)
|
64
|
+
- [`String#to_uuid`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringto_uuid)
|
65
|
+
- [Boolean Typecasting](https://github.com/forgecrafted/finishing_moves/wiki/Boolean-Typecasting) (*multi-class enhancement*)
|
65
66
|
|
66
67
|
### Ruby Version
|
67
68
|
|
68
|
-
Tested against **`2.
|
69
|
+
Tested against all supported versions of official RVM, currently **`2.5.0` and above**.
|
69
70
|
|
70
71
|
## Development approach
|
71
72
|
|
@@ -73,7 +74,6 @@ Tested against **`2.0.0` and above**. Probably works in `1.9.3`.
|
|
73
74
|
- Follow the Unix philosophy of *"Do one job really well."*
|
74
75
|
- Minimize assumptions, e.g. avoid formatting output, mutating values, and conditional logic flows.
|
75
76
|
- Play nice with major Ruby players like Rake, Rails, and Sinatra.
|
76
|
-
- Never duplicate existing methods from Rails and the like.
|
77
77
|
- Test all the things.
|
78
78
|
|
79
79
|
## Bug Reports
|
data/Vagrantfile
CHANGED
@@ -6,7 +6,7 @@ FQDN = "#{NAME}.example.com"
|
|
6
6
|
|
7
7
|
Vagrant.configure("2") do |config|
|
8
8
|
# "trusty" is 14.04
|
9
|
-
config.vm.box = "ubuntu/
|
9
|
+
config.vm.box = "ubuntu/focal64"
|
10
10
|
|
11
11
|
# Use the normal insecure key
|
12
12
|
# https://github.com/mitchellh/vagrant/issues/2608
|
@@ -18,7 +18,7 @@ Vagrant.configure("2") do |config|
|
|
18
18
|
"--name", NAME,
|
19
19
|
"--memory", 4096,
|
20
20
|
# I/O APIC must be enabled to support a multi-core guest.
|
21
|
-
"--cpus",
|
21
|
+
"--cpus", 2,
|
22
22
|
"--ioapic", "on",
|
23
23
|
# Enable native host virtualization features (yields better performance).
|
24
24
|
"--pae", "on",
|
data/finishing_moves.gemspec
CHANGED
@@ -19,13 +19,10 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = `git ls-files -z`.split("\x0")
|
20
20
|
s.test_files = Dir["spec/**/*"]
|
21
21
|
|
22
|
-
s.add_development_dependency 'rb-readline', '>= 0'
|
23
22
|
s.add_development_dependency 'rspec', '~> 3.1.0'
|
24
|
-
s.add_development_dependency 'priscilla', '>= 0'
|
25
|
-
s.add_development_dependency 'pry-byebug', '>= 0'
|
26
23
|
s.add_development_dependency 'fuubar', '>= 0'
|
27
|
-
s.add_development_dependency 'coveralls', '>= 0
|
24
|
+
s.add_development_dependency 'coveralls', '>= 0'
|
28
25
|
|
29
|
-
s.required_ruby_version = '>= 2.
|
26
|
+
s.required_ruby_version = '>= 2.7.0'
|
30
27
|
|
31
28
|
end
|
@@ -27,13 +27,34 @@ class Array
|
|
27
27
|
end
|
28
28
|
alias_method :to_hash_as_keys, :to_hash_keys
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
reject { |item| item.nil? || bool_chain{item.strip.empty?} }
|
30
|
+
def to_sym_strict
|
31
|
+
map { |x| x.to_sym }
|
33
32
|
end
|
34
33
|
|
35
|
-
def
|
36
|
-
|
34
|
+
def to_sym_strict!
|
35
|
+
map! { |x| x.to_sym }
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_sym_loose
|
39
|
+
map do |x|
|
40
|
+
if x.respond_to?(:to_sym)
|
41
|
+
x.to_sym
|
42
|
+
else
|
43
|
+
x
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_sym_loose!
|
49
|
+
map! do |x|
|
50
|
+
begin
|
51
|
+
x.to_sym
|
52
|
+
rescue NoMethodError => e
|
53
|
+
x
|
54
|
+
rescue Exception
|
55
|
+
raise
|
56
|
+
end
|
57
|
+
end
|
37
58
|
end
|
38
59
|
|
39
60
|
end
|
data/lib/finishing_moves/hash.rb
CHANGED
@@ -24,13 +24,11 @@ class Hash
|
|
24
24
|
return self
|
25
25
|
end
|
26
26
|
|
27
|
-
#
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
def crush!
|
33
|
-
reject! { |item| item.nil? || bool_chain{item.strip.empty?} }
|
27
|
+
# TODO
|
28
|
+
# Replicate `sample` method functionality from Array
|
29
|
+
def sample
|
30
|
+
key = self.keys.sample
|
31
|
+
return {:"#{key}" => self[key]}
|
34
32
|
end
|
35
33
|
|
36
34
|
end
|
@@ -94,6 +94,17 @@ class String
|
|
94
94
|
match(pattern, pos).not_nil?
|
95
95
|
end
|
96
96
|
|
97
|
+
def to_uuid
|
98
|
+
if length == 36 && self.match?(/^[0-9A-F-]+$/i)
|
99
|
+
return self
|
100
|
+
elsif length == 32 && self.match?(/^[0-9A-F]+$/i)
|
101
|
+
str = self.dup
|
102
|
+
return str[0,8] + '-' +str[8,4] + '-' +str[12,4] + '-' +str[16,4] + '-' +str[20,12]
|
103
|
+
else
|
104
|
+
raise ArgumentError, "#{self} is not a valid UUID"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
97
108
|
# TODO
|
98
109
|
# def each_char_index(&block)
|
99
110
|
# how to return enumerator if no block given?
|
data/provision.sh
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Shell user settings.
|
4
4
|
USER_NAME=vagrant
|
5
5
|
USER_HOME=/home/$USER_NAME
|
6
|
-
DEFAULT_RUBY='
|
6
|
+
DEFAULT_RUBY='3.1.2'
|
7
7
|
|
8
8
|
###############################################################################
|
9
9
|
# Functions
|
@@ -27,7 +27,7 @@ apt-get -yfV dist-upgrade
|
|
27
27
|
###############################################################################
|
28
28
|
|
29
29
|
# Install dependencies.
|
30
|
-
apt-get install -yfV \
|
30
|
+
sudo apt-get install -yfV \
|
31
31
|
build-essential \
|
32
32
|
curl \
|
33
33
|
git-core \
|
@@ -38,9 +38,18 @@ apt-get install -yfV \
|
|
38
38
|
libxml2-dev \
|
39
39
|
libxslt1-dev \
|
40
40
|
libyaml-dev \
|
41
|
-
|
41
|
+
software-properties-common \
|
42
42
|
sqlite3 \
|
43
43
|
zlib1g-dev \
|
44
|
+
autoconf \
|
45
|
+
bison \
|
46
|
+
libreadline6-dev \
|
47
|
+
libncurses5-dev \
|
48
|
+
libffi-dev \
|
49
|
+
libgdbm6 \
|
50
|
+
libgdbm-dev \
|
51
|
+
libdb-dev \
|
52
|
+
uuid-dev
|
44
53
|
|
45
54
|
# Install rbenv and ruby-build.
|
46
55
|
as_user "git clone https://github.com/sstephenson/rbenv.git $USER_HOME/.rbenv"
|
data/spec/array_spec.rb
CHANGED
@@ -99,6 +99,32 @@ describe Array do
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
+
it '#to_sym_strict' do
|
103
|
+
test = ['FOO', 'bar', :baz]
|
104
|
+
expect(test.to_sym_strict).to eq [:FOO, :bar, :baz]
|
105
|
+
expect(test).to eq ['FOO', 'bar', :baz]
|
106
|
+
expect{ [1].to_sym_strict }.to raise_error NoMethodError
|
107
|
+
end
|
108
|
+
|
109
|
+
it '#to_sym_strict!' do
|
110
|
+
test = ['FOO', 'bar', :baz]
|
111
|
+
expect(test.to_sym_strict!).to eq [:FOO, :bar, :baz]
|
112
|
+
expect(test).to eq [:FOO, :bar, :baz]
|
113
|
+
expect{ [1].to_sym_strict! }.to raise_error NoMethodError
|
114
|
+
end
|
115
|
+
|
116
|
+
it '#to_sym_loose' do
|
117
|
+
test = ['FOO', 'bar', :baz, 1, {bat: 'bat'}, /hay/]
|
118
|
+
expect(test.to_sym_loose).to eq [:FOO, :bar, :baz, 1, {bat: 'bat'}, /hay/]
|
119
|
+
expect(test).to eq ['FOO', 'bar', :baz, 1, {bat: 'bat'}, /hay/]
|
120
|
+
end
|
121
|
+
|
122
|
+
it '#to_sym_loose!' do
|
123
|
+
test = ['FOO', 'bar', :baz, 1, {bat: 'bat'}, /hay/]
|
124
|
+
expect(test.to_sym_loose!).to eq [:FOO, :bar, :baz, 1, {bat: 'bat'}, /hay/]
|
125
|
+
expect(test).to eq [:FOO, :bar, :baz, 1, {bat: 'bat'}, /hay/]
|
126
|
+
end
|
127
|
+
|
102
128
|
end
|
103
129
|
|
104
130
|
class SageElements
|
data/spec/hash_spec.rb
CHANGED
@@ -27,4 +27,18 @@ describe Hash do
|
|
27
27
|
expect(test_hash.delete_each!(:baz)).to eq({ })
|
28
28
|
end
|
29
29
|
|
30
|
+
it '#sample' do
|
31
|
+
test_hash = {
|
32
|
+
"Eastern Time (US & Canada)" => "America/New_York",
|
33
|
+
"Central Time (US & Canada)" => "America/Chicago",
|
34
|
+
"Mountain Time (US & Canada)" => "America/Denver",
|
35
|
+
"Pacific Time (US & Canada)" => "America/Los_Angeles",
|
36
|
+
"Indiana (East)" => "America/Indiana/Indianapolis",
|
37
|
+
"Arizona" => "America/Phoenix",
|
38
|
+
}
|
39
|
+
test_hash_clone = test_hash.dup
|
40
|
+
test_hash.sample
|
41
|
+
|
42
|
+
end
|
43
|
+
|
30
44
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/string_spec.rb
CHANGED
@@ -1,259 +1,280 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe String do
|
4
|
-
|
5
|
-
it '#dedupe' do
|
6
|
-
expect('___foo___'.dedupe('_')).to eq '_foo_'
|
7
|
-
expect('---foo---'.dedupe('-')).to eq '-foo-'
|
8
|
-
expect('___foo---'.dedupe('_-')).to eq '_foo-'
|
9
|
-
expect('___foo__bar_baz--bing'.dedupe('_')).to eq '_foo_bar_baz--bing'
|
10
|
-
expect('foo'.dedupe('o')).to eq 'fo'
|
11
|
-
expect('foo'.dedupe('O')).to eq 'foo'
|
12
|
-
expect('[[foo]]]'.dedupe('[]')).to eq '[foo]'
|
13
|
-
expect('/crazy//concatenated////file/path'.dedupe('/')).to eq '/crazy/concatenated/file/path'
|
14
|
-
|
15
|
-
# make sure our use of gsub! isn't screwing us over
|
16
|
-
orig = '___foo___'
|
17
|
-
modified = orig.dedupe('_')
|
18
|
-
expect(modified).to eq '_foo_'
|
19
|
-
expect(orig).to eq '___foo___'
|
20
|
-
end
|
21
|
-
|
22
|
-
it '#dedupe!' do
|
23
|
-
str = '___foo___'
|
24
|
-
str.dedupe!('_')
|
25
|
-
expect(str).to eq '_foo_'
|
26
|
-
end
|
27
|
-
|
28
|
-
it '#strip_all (incl _strip_all_prep)' do
|
29
|
-
expect('___foo___'.strip_all).to eq 'foo'
|
30
|
-
expect('---foo---'.strip_all).to eq 'foo'
|
31
|
-
expect('-_-foo-_-'.strip_all).to eq 'foo'
|
32
|
-
expect('_-_8-foo-8_-_'.strip_all).to eq '8-foo-8'
|
33
|
-
expect('0123456789-foo-9876543210'.strip_all('0-9')).to eq '-foo-'
|
34
|
-
expect('0123-foo-3210'.strip_all('0-9-')).to eq 'foo'
|
35
|
-
expect('0123-foo-3210'.strip_all('a-z')).to eq '0123-foo-3210'
|
36
|
-
expect('foo-314-foo'.strip_all('a-z')).to eq '-314-'
|
37
|
-
expect('foo-314-foo'.strip_all('a-z-')).to eq '314'
|
38
|
-
expect('foo-314-foo'.strip_all('A-Z')).to eq 'foo-314-foo'
|
39
|
-
expect('FOO-314-FOO'.strip_all('A-Z')).to eq '-314-'
|
40
|
-
expect('FOO 314 FOO'.strip_all('A-Z')).to eq '314'
|
41
|
-
|
42
|
-
expect('abcdefghijklmnopqrstuvwxyz'.strip_all('a-z')).to eq ''
|
43
|
-
expect('ABCDEFGHIJKLMNOPQRSTUVWXYZ'.strip_all('A-Z')).to eq ''
|
44
|
-
expect('ABCDEFGHIJKLM FOO NOPQRSTUVWXYZ'.strip_all('A-Z')).to eq ''
|
45
|
-
|
46
|
-
expect('000000'.strip_all('0')).to eq ''
|
47
|
-
expect('[[000]]'.strip_all('[0]')).to eq ''
|
48
|
-
expect('. $ ^ { [ ( | ) * + ? \ '.strip_all('. $ ^ { [ ( | ) * + ? \ ')).to eq ''
|
49
|
-
expect('/[a|valid|regex]+/'.strip_all('/[]+')).to eq 'a|valid|regex'
|
50
|
-
|
51
|
-
expect('_1 0__spaces_incl__0 1_'.strip_all('0-9_')).to eq 'spaces_incl'
|
52
|
-
expect(' _spaces_incl_ '.strip_all).to eq 'spaces_incl'
|
53
|
-
|
54
|
-
expect("__'''foo__'".strip_all('_\'') ).to eq 'foo'
|
55
|
-
expect('abcdefghijklm foo123 nopqrstuvwxyz'.strip_all('a-z0-9')).to eq ''
|
56
|
-
expect('hello world'.strip_all('a-z')).to eq ''
|
57
|
-
|
58
|
-
expect{'bad call'.strip_all(101)}.to raise_error(ArgumentError)
|
59
|
-
end
|
60
|
-
|
61
|
-
it '#strip_all!' do
|
62
|
-
str = '___foo___'
|
63
|
-
str.strip_all!
|
64
|
-
expect(str).to eq 'foo'
|
65
|
-
end
|
66
|
-
|
67
|
-
it '#lstrip_all' do
|
68
|
-
expect('___foo___'.lstrip_all).to eq 'foo___'
|
69
|
-
end
|
70
|
-
|
71
|
-
it '#lstrip_all!' do
|
72
|
-
str = '___foo___'
|
73
|
-
str.lstrip_all!
|
74
|
-
expect(str).to eq 'foo___'
|
75
|
-
end
|
76
|
-
|
77
|
-
it '#rstrip_all' do
|
78
|
-
expect('___foo___'.rstrip_all).to eq '___foo'
|
79
|
-
end
|
80
|
-
|
81
|
-
it '#rstrip_all!' do
|
82
|
-
str = '___foo___'
|
83
|
-
str.rstrip_all!
|
84
|
-
expect(str).to eq '___foo'
|
85
|
-
end
|
86
|
-
|
87
|
-
it '#match?' do
|
88
|
-
expect('hello'.match?('he')).to be true
|
89
|
-
expect('hello'.match?('he', 1)).to be false
|
90
|
-
expect('hello'.match?('o')).to be true
|
91
|
-
expect('hello'.match?('ol')).to be false
|
92
|
-
expect('hello'.match?('(.)')).to be true
|
93
|
-
expect('hello'.match?(/(.)/)).to be true
|
94
|
-
expect('hello'.match?('xx')).to be false
|
95
|
-
end
|
96
|
-
|
97
|
-
it '#remove_whitespace' do
|
98
|
-
expect(' a b c d e'.remove_whitespace).to eq 'abcde'
|
99
|
-
expect(' [ foo ] '.remove_whitespace).to eq '[foo]'
|
100
|
-
expect(' '.remove_whitespace).to eq ''
|
101
|
-
expect('. $ ^ { [ ( | ) * + ? \ '.remove_whitespace).to eq '.$^{[(|)*+?\\'
|
102
|
-
expect('a b c d e'.remove_whitespace('+')).to eq 'abcde'
|
103
|
-
expect('a b c d e'.remove_whitespace('+')).to eq 'abcde'
|
104
|
-
expect('a b c d e'.remove_whitespace('__')).to eq 'abcde'
|
105
|
-
end
|
106
|
-
|
107
|
-
it '#remove_whitespace!' do
|
108
|
-
str = ' a b c d e'
|
109
|
-
str.remove_whitespace!
|
110
|
-
expect(str).to eq 'abcde'
|
111
|
-
end
|
112
|
-
|
113
|
-
it '#replace_whitespace' do
|
114
|
-
expect(' a b c d e'.replace_whitespace).to eq 'abcde'
|
115
|
-
expect('a b c d e'.replace_whitespace('+')).to eq 'a+b+c+d+e'
|
116
|
-
expect('a b c d e'.replace_whitespace('+')).to eq 'a++b+c+d+e'
|
117
|
-
expect('a b c d e'.replace_whitespace('__')).to eq 'a__b__c__d__e'
|
118
|
-
end
|
119
|
-
|
120
|
-
it '#replace_whitespace!' do
|
121
|
-
str = 'a b c d e'
|
122
|
-
str.replace_whitespace!('-')
|
123
|
-
expect(str).to eq 'a-b-c-d-e'
|
124
|
-
end
|
125
|
-
|
126
|
-
it '#nl2br' do
|
127
|
-
expect("\n".nl2br).to eq "<br />\n"
|
128
|
-
expect("\n\r".nl2br).to eq "<br />\n"
|
129
|
-
expect("\r\n".nl2br).to eq "<br />\n"
|
130
|
-
expect("\n\r\n".nl2br).to eq "<br />\n<br />\n"
|
131
|
-
expect("\r\n\r\n".nl2br).to eq "<br />\n<br />\n"
|
132
|
-
expect("\r\r\n".nl2br).to eq "<br />\n<br />\n"
|
133
|
-
expect("\r\r".nl2br).to eq "<br />\n<br />\n"
|
134
|
-
expect("\n\r\r".nl2br).to eq "<br />\n<br />\n"
|
135
|
-
|
136
|
-
expect("Let's play Global Thermonuclear War.\n\r".nl2br).to eq "Let's play Global Thermonuclear War.<br />\n"
|
137
|
-
expect("A strange game.\n\nThe only winning move is not to play.\r\nHow about a nice game of chess?\r".nl2br).
|
138
|
-
to eq "A strange game.<br />\n<br />\nThe only winning move is not to play.<br />\nHow about a nice game of chess?<br />\n"
|
139
|
-
end
|
140
|
-
|
141
|
-
it "#newline_to" do
|
142
|
-
expect("\n".newline_to).to eq " "
|
143
|
-
expect("\n\r".newline_to).to eq " "
|
144
|
-
expect("\r\n".newline_to).to eq " "
|
145
|
-
expect("\n\r\n".newline_to).to eq " "
|
146
|
-
expect("\r\n\r\n".newline_to).to eq " "
|
147
|
-
expect("\r\r\n".newline_to).to eq " "
|
148
|
-
expect("\r\r".newline_to).to eq " "
|
149
|
-
expect("\n\r\r".newline_to).to eq " "
|
150
|
-
|
151
|
-
# replacements should end up as strings
|
152
|
-
expect("\n".newline_to(:bar)).to eq 'bar'
|
153
|
-
expect("\n\n".newline_to('+')).to eq '++'
|
154
|
-
expect("\n\n".newline_to(0)).to eq '00'
|
155
|
-
expect("\n\n".newline_to(true)).to eq 'truetrue'
|
156
|
-
|
157
|
-
# should return a modified object, leaving original intact
|
158
|
-
newline = "\n"
|
159
|
-
bar = newline.newline_to(:bar)
|
160
|
-
expect(newline).to eq "\n"
|
161
|
-
expect(bar).to eq 'bar'
|
162
|
-
|
163
|
-
expect("Let's play Global Thermonuclear War.\n\r".newline_to).to eq "Let's play Global Thermonuclear War. "
|
164
|
-
expect("A strange game.\n\nThe only winning move is not to play.\r\nHow about a nice game of chess?\r".newline_to).
|
165
|
-
to eq "A strange game. The only winning move is not to play. How about a nice game of chess? "
|
166
|
-
end
|
167
|
-
|
168
|
-
it "#newline_to!" do
|
169
|
-
var = "\n"
|
170
|
-
var.newline_to! :foo
|
171
|
-
expect(var).to eq 'foo'
|
172
|
-
end
|
173
|
-
|
174
|
-
keyify_sets = [
|
175
|
-
[Integer, :integer],
|
176
|
-
[Math::DomainError, :math_domain_error],
|
177
|
-
['FooBarBaz', :foo_bar_baz],
|
178
|
-
[:FooBarBaz, :foo_bar_baz],
|
179
|
-
["Foo-Bar'Baz", :foo_bar_baz],
|
180
|
-
['(Foo*&Bar!Baz?', :foo_bar_baz],
|
181
|
-
['1234FooBAR', :foo_bar],
|
182
|
-
['!@#$Foo0987', :foo0987],
|
183
|
-
["Bill O'Shea", :bill_o_shea],
|
184
|
-
["Bill O Shea", :bill_o_shea],
|
185
|
-
["Bill O Shea", :bill_o_shea],
|
186
|
-
]
|
187
|
-
|
188
|
-
it '#keyify' do
|
189
|
-
keyify_sets.each do |set|
|
190
|
-
inc, out = set
|
191
|
-
expect(inc.keyify).to eq out
|
192
|
-
end
|
193
|
-
expect('!@#$%^'.keyify).to eq nil
|
194
|
-
expect('12345678'.keyify).to eq nil
|
195
|
-
# make sure we're not performing in place
|
196
|
-
str = 'FooBarBaz'
|
197
|
-
expect(str.keyify).to eq :foo_bar_baz
|
198
|
-
expect(str).to eq 'FooBarBaz'
|
199
|
-
# should work on frozen values
|
200
|
-
expect('FooBarBaz'.freeze.keyify).to eq :foo_bar_baz
|
201
|
-
end
|
202
|
-
|
203
|
-
it '#keyify!' do
|
204
|
-
keyify_sets.each do |set|
|
205
|
-
inc, out = set
|
206
|
-
expect(inc.keyify!).to eq out
|
207
|
-
end
|
208
|
-
expect{ '!@#$%^'.keyify! }.to raise_error(ArgumentError)
|
209
|
-
expect{ '12345678'.keyify! }.to raise_error(ArgumentError)
|
210
|
-
end
|
211
|
-
|
212
|
-
it "dedupe + remove_whitespace" do
|
213
|
-
expect('1 2 3 4 5'.dedupe(' ').remove_whitespace('+')).to eq '12345'
|
214
|
-
expect('1 2 3 4 5'.dedupe(' ').replace_whitespace('+')).to eq '1+2+3+4+5'
|
215
|
-
end
|
216
|
-
|
217
|
-
slugify_sets = [
|
218
|
-
[Integer, 'integer'],
|
219
|
-
[Math::DomainError, 'math-domain-error'],
|
220
|
-
['FooBarBaz', 'foo-bar-baz'],
|
221
|
-
[:FooBarBaz, 'foo-bar-baz'],
|
222
|
-
["Foo-Bar'Baz", 'foo-bar-baz'],
|
223
|
-
['(Foo*&Bar!Baz?', 'foo-bar-baz'],
|
224
|
-
["Bill O'Shea", 'bill-o-shea'],
|
225
|
-
["Bill O Shea", 'bill-o-shea'],
|
226
|
-
["Bill O Shea", 'bill-o-shea'],
|
227
|
-
]
|
228
|
-
|
229
|
-
it '#slugify' do
|
230
|
-
slugify_sets.each do |set|
|
231
|
-
inc, out = set
|
232
|
-
expect(inc.slugify).to eq out
|
233
|
-
end
|
234
|
-
expect('!@#$Foo0987'.slugify).to eq 'foo0987'
|
235
|
-
expect('!@#$%^'.slugify).to eq nil
|
236
|
-
# make sure we're not performing in place
|
237
|
-
str = 'FooBarBaz'
|
238
|
-
expect(str.slugify).to eq 'foo-bar-baz'
|
239
|
-
expect(str).to eq 'FooBarBaz'
|
240
|
-
|
241
|
-
# we permit leading numbers, unlike keyify
|
242
|
-
expect('!1234FooBAR'.slugify).to eq '1234-foo-bar'
|
243
|
-
expect('1234FooBAR'.slugify).to eq '1234-foo-bar'
|
244
|
-
expect('12345678'.slugify).to eq '12345678'
|
245
|
-
|
246
|
-
# should work on frozen values
|
247
|
-
expect('FooBarBaz'.freeze.slugify).to eq 'foo-bar-baz'
|
248
|
-
end
|
249
|
-
|
250
|
-
it '#slugify!' do
|
251
|
-
slugify_sets.each do |set|
|
252
|
-
inc, out = set
|
253
|
-
expect(inc.slugify!).to eq out
|
254
|
-
end
|
255
|
-
expect{ '!@#$%^'.slugify! }.to raise_error(ArgumentError)
|
256
|
-
expect{ '12345678'.slugify! }.not_to raise_error
|
257
|
-
end
|
258
|
-
|
259
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe String do
|
4
|
+
|
5
|
+
it '#dedupe' do
|
6
|
+
expect('___foo___'.dedupe('_')).to eq '_foo_'
|
7
|
+
expect('---foo---'.dedupe('-')).to eq '-foo-'
|
8
|
+
expect('___foo---'.dedupe('_-')).to eq '_foo-'
|
9
|
+
expect('___foo__bar_baz--bing'.dedupe('_')).to eq '_foo_bar_baz--bing'
|
10
|
+
expect('foo'.dedupe('o')).to eq 'fo'
|
11
|
+
expect('foo'.dedupe('O')).to eq 'foo'
|
12
|
+
expect('[[foo]]]'.dedupe('[]')).to eq '[foo]'
|
13
|
+
expect('/crazy//concatenated////file/path'.dedupe('/')).to eq '/crazy/concatenated/file/path'
|
14
|
+
|
15
|
+
# make sure our use of gsub! isn't screwing us over
|
16
|
+
orig = '___foo___'
|
17
|
+
modified = orig.dedupe('_')
|
18
|
+
expect(modified).to eq '_foo_'
|
19
|
+
expect(orig).to eq '___foo___'
|
20
|
+
end
|
21
|
+
|
22
|
+
it '#dedupe!' do
|
23
|
+
str = '___foo___'
|
24
|
+
str.dedupe!('_')
|
25
|
+
expect(str).to eq '_foo_'
|
26
|
+
end
|
27
|
+
|
28
|
+
it '#strip_all (incl _strip_all_prep)' do
|
29
|
+
expect('___foo___'.strip_all).to eq 'foo'
|
30
|
+
expect('---foo---'.strip_all).to eq 'foo'
|
31
|
+
expect('-_-foo-_-'.strip_all).to eq 'foo'
|
32
|
+
expect('_-_8-foo-8_-_'.strip_all).to eq '8-foo-8'
|
33
|
+
expect('0123456789-foo-9876543210'.strip_all('0-9')).to eq '-foo-'
|
34
|
+
expect('0123-foo-3210'.strip_all('0-9-')).to eq 'foo'
|
35
|
+
expect('0123-foo-3210'.strip_all('a-z')).to eq '0123-foo-3210'
|
36
|
+
expect('foo-314-foo'.strip_all('a-z')).to eq '-314-'
|
37
|
+
expect('foo-314-foo'.strip_all('a-z-')).to eq '314'
|
38
|
+
expect('foo-314-foo'.strip_all('A-Z')).to eq 'foo-314-foo'
|
39
|
+
expect('FOO-314-FOO'.strip_all('A-Z')).to eq '-314-'
|
40
|
+
expect('FOO 314 FOO'.strip_all('A-Z')).to eq '314'
|
41
|
+
|
42
|
+
expect('abcdefghijklmnopqrstuvwxyz'.strip_all('a-z')).to eq ''
|
43
|
+
expect('ABCDEFGHIJKLMNOPQRSTUVWXYZ'.strip_all('A-Z')).to eq ''
|
44
|
+
expect('ABCDEFGHIJKLM FOO NOPQRSTUVWXYZ'.strip_all('A-Z')).to eq ''
|
45
|
+
|
46
|
+
expect('000000'.strip_all('0')).to eq ''
|
47
|
+
expect('[[000]]'.strip_all('[0]')).to eq ''
|
48
|
+
expect('. $ ^ { [ ( | ) * + ? \ '.strip_all('. $ ^ { [ ( | ) * + ? \ ')).to eq ''
|
49
|
+
expect('/[a|valid|regex]+/'.strip_all('/[]+')).to eq 'a|valid|regex'
|
50
|
+
|
51
|
+
expect('_1 0__spaces_incl__0 1_'.strip_all('0-9_')).to eq 'spaces_incl'
|
52
|
+
expect(' _spaces_incl_ '.strip_all).to eq 'spaces_incl'
|
53
|
+
|
54
|
+
expect("__'''foo__'".strip_all('_\'') ).to eq 'foo'
|
55
|
+
expect('abcdefghijklm foo123 nopqrstuvwxyz'.strip_all('a-z0-9')).to eq ''
|
56
|
+
expect('hello world'.strip_all('a-z')).to eq ''
|
57
|
+
|
58
|
+
expect{'bad call'.strip_all(101)}.to raise_error(ArgumentError)
|
59
|
+
end
|
60
|
+
|
61
|
+
it '#strip_all!' do
|
62
|
+
str = '___foo___'
|
63
|
+
str.strip_all!
|
64
|
+
expect(str).to eq 'foo'
|
65
|
+
end
|
66
|
+
|
67
|
+
it '#lstrip_all' do
|
68
|
+
expect('___foo___'.lstrip_all).to eq 'foo___'
|
69
|
+
end
|
70
|
+
|
71
|
+
it '#lstrip_all!' do
|
72
|
+
str = '___foo___'
|
73
|
+
str.lstrip_all!
|
74
|
+
expect(str).to eq 'foo___'
|
75
|
+
end
|
76
|
+
|
77
|
+
it '#rstrip_all' do
|
78
|
+
expect('___foo___'.rstrip_all).to eq '___foo'
|
79
|
+
end
|
80
|
+
|
81
|
+
it '#rstrip_all!' do
|
82
|
+
str = '___foo___'
|
83
|
+
str.rstrip_all!
|
84
|
+
expect(str).to eq '___foo'
|
85
|
+
end
|
86
|
+
|
87
|
+
it '#match?' do
|
88
|
+
expect('hello'.match?('he')).to be true
|
89
|
+
expect('hello'.match?('he', 1)).to be false
|
90
|
+
expect('hello'.match?('o')).to be true
|
91
|
+
expect('hello'.match?('ol')).to be false
|
92
|
+
expect('hello'.match?('(.)')).to be true
|
93
|
+
expect('hello'.match?(/(.)/)).to be true
|
94
|
+
expect('hello'.match?('xx')).to be false
|
95
|
+
end
|
96
|
+
|
97
|
+
it '#remove_whitespace' do
|
98
|
+
expect(' a b c d e'.remove_whitespace).to eq 'abcde'
|
99
|
+
expect(' [ foo ] '.remove_whitespace).to eq '[foo]'
|
100
|
+
expect(' '.remove_whitespace).to eq ''
|
101
|
+
expect('. $ ^ { [ ( | ) * + ? \ '.remove_whitespace).to eq '.$^{[(|)*+?\\'
|
102
|
+
expect('a b c d e'.remove_whitespace('+')).to eq 'abcde'
|
103
|
+
expect('a b c d e'.remove_whitespace('+')).to eq 'abcde'
|
104
|
+
expect('a b c d e'.remove_whitespace('__')).to eq 'abcde'
|
105
|
+
end
|
106
|
+
|
107
|
+
it '#remove_whitespace!' do
|
108
|
+
str = ' a b c d e'
|
109
|
+
str.remove_whitespace!
|
110
|
+
expect(str).to eq 'abcde'
|
111
|
+
end
|
112
|
+
|
113
|
+
it '#replace_whitespace' do
|
114
|
+
expect(' a b c d e'.replace_whitespace).to eq 'abcde'
|
115
|
+
expect('a b c d e'.replace_whitespace('+')).to eq 'a+b+c+d+e'
|
116
|
+
expect('a b c d e'.replace_whitespace('+')).to eq 'a++b+c+d+e'
|
117
|
+
expect('a b c d e'.replace_whitespace('__')).to eq 'a__b__c__d__e'
|
118
|
+
end
|
119
|
+
|
120
|
+
it '#replace_whitespace!' do
|
121
|
+
str = 'a b c d e'
|
122
|
+
str.replace_whitespace!('-')
|
123
|
+
expect(str).to eq 'a-b-c-d-e'
|
124
|
+
end
|
125
|
+
|
126
|
+
it '#nl2br' do
|
127
|
+
expect("\n".nl2br).to eq "<br />\n"
|
128
|
+
expect("\n\r".nl2br).to eq "<br />\n"
|
129
|
+
expect("\r\n".nl2br).to eq "<br />\n"
|
130
|
+
expect("\n\r\n".nl2br).to eq "<br />\n<br />\n"
|
131
|
+
expect("\r\n\r\n".nl2br).to eq "<br />\n<br />\n"
|
132
|
+
expect("\r\r\n".nl2br).to eq "<br />\n<br />\n"
|
133
|
+
expect("\r\r".nl2br).to eq "<br />\n<br />\n"
|
134
|
+
expect("\n\r\r".nl2br).to eq "<br />\n<br />\n"
|
135
|
+
|
136
|
+
expect("Let's play Global Thermonuclear War.\n\r".nl2br).to eq "Let's play Global Thermonuclear War.<br />\n"
|
137
|
+
expect("A strange game.\n\nThe only winning move is not to play.\r\nHow about a nice game of chess?\r".nl2br).
|
138
|
+
to eq "A strange game.<br />\n<br />\nThe only winning move is not to play.<br />\nHow about a nice game of chess?<br />\n"
|
139
|
+
end
|
140
|
+
|
141
|
+
it "#newline_to" do
|
142
|
+
expect("\n".newline_to).to eq " "
|
143
|
+
expect("\n\r".newline_to).to eq " "
|
144
|
+
expect("\r\n".newline_to).to eq " "
|
145
|
+
expect("\n\r\n".newline_to).to eq " "
|
146
|
+
expect("\r\n\r\n".newline_to).to eq " "
|
147
|
+
expect("\r\r\n".newline_to).to eq " "
|
148
|
+
expect("\r\r".newline_to).to eq " "
|
149
|
+
expect("\n\r\r".newline_to).to eq " "
|
150
|
+
|
151
|
+
# replacements should end up as strings
|
152
|
+
expect("\n".newline_to(:bar)).to eq 'bar'
|
153
|
+
expect("\n\n".newline_to('+')).to eq '++'
|
154
|
+
expect("\n\n".newline_to(0)).to eq '00'
|
155
|
+
expect("\n\n".newline_to(true)).to eq 'truetrue'
|
156
|
+
|
157
|
+
# should return a modified object, leaving original intact
|
158
|
+
newline = "\n"
|
159
|
+
bar = newline.newline_to(:bar)
|
160
|
+
expect(newline).to eq "\n"
|
161
|
+
expect(bar).to eq 'bar'
|
162
|
+
|
163
|
+
expect("Let's play Global Thermonuclear War.\n\r".newline_to).to eq "Let's play Global Thermonuclear War. "
|
164
|
+
expect("A strange game.\n\nThe only winning move is not to play.\r\nHow about a nice game of chess?\r".newline_to).
|
165
|
+
to eq "A strange game. The only winning move is not to play. How about a nice game of chess? "
|
166
|
+
end
|
167
|
+
|
168
|
+
it "#newline_to!" do
|
169
|
+
var = "\n"
|
170
|
+
var.newline_to! :foo
|
171
|
+
expect(var).to eq 'foo'
|
172
|
+
end
|
173
|
+
|
174
|
+
keyify_sets = [
|
175
|
+
[Integer, :integer],
|
176
|
+
[Math::DomainError, :math_domain_error],
|
177
|
+
['FooBarBaz', :foo_bar_baz],
|
178
|
+
[:FooBarBaz, :foo_bar_baz],
|
179
|
+
["Foo-Bar'Baz", :foo_bar_baz],
|
180
|
+
['(Foo*&Bar!Baz?', :foo_bar_baz],
|
181
|
+
['1234FooBAR', :foo_bar],
|
182
|
+
['!@#$Foo0987', :foo0987],
|
183
|
+
["Bill O'Shea", :bill_o_shea],
|
184
|
+
["Bill O Shea", :bill_o_shea],
|
185
|
+
["Bill O Shea", :bill_o_shea],
|
186
|
+
]
|
187
|
+
|
188
|
+
it '#keyify' do
|
189
|
+
keyify_sets.each do |set|
|
190
|
+
inc, out = set
|
191
|
+
expect(inc.keyify).to eq out
|
192
|
+
end
|
193
|
+
expect('!@#$%^'.keyify).to eq nil
|
194
|
+
expect('12345678'.keyify).to eq nil
|
195
|
+
# make sure we're not performing in place
|
196
|
+
str = 'FooBarBaz'
|
197
|
+
expect(str.keyify).to eq :foo_bar_baz
|
198
|
+
expect(str).to eq 'FooBarBaz'
|
199
|
+
# should work on frozen values
|
200
|
+
expect('FooBarBaz'.freeze.keyify).to eq :foo_bar_baz
|
201
|
+
end
|
202
|
+
|
203
|
+
it '#keyify!' do
|
204
|
+
keyify_sets.each do |set|
|
205
|
+
inc, out = set
|
206
|
+
expect(inc.keyify!).to eq out
|
207
|
+
end
|
208
|
+
expect{ '!@#$%^'.keyify! }.to raise_error(ArgumentError)
|
209
|
+
expect{ '12345678'.keyify! }.to raise_error(ArgumentError)
|
210
|
+
end
|
211
|
+
|
212
|
+
it "dedupe + remove_whitespace" do
|
213
|
+
expect('1 2 3 4 5'.dedupe(' ').remove_whitespace('+')).to eq '12345'
|
214
|
+
expect('1 2 3 4 5'.dedupe(' ').replace_whitespace('+')).to eq '1+2+3+4+5'
|
215
|
+
end
|
216
|
+
|
217
|
+
slugify_sets = [
|
218
|
+
[Integer, 'integer'],
|
219
|
+
[Math::DomainError, 'math-domain-error'],
|
220
|
+
['FooBarBaz', 'foo-bar-baz'],
|
221
|
+
[:FooBarBaz, 'foo-bar-baz'],
|
222
|
+
["Foo-Bar'Baz", 'foo-bar-baz'],
|
223
|
+
['(Foo*&Bar!Baz?', 'foo-bar-baz'],
|
224
|
+
["Bill O'Shea", 'bill-o-shea'],
|
225
|
+
["Bill O Shea", 'bill-o-shea'],
|
226
|
+
["Bill O Shea", 'bill-o-shea'],
|
227
|
+
]
|
228
|
+
|
229
|
+
it '#slugify' do
|
230
|
+
slugify_sets.each do |set|
|
231
|
+
inc, out = set
|
232
|
+
expect(inc.slugify).to eq out
|
233
|
+
end
|
234
|
+
expect('!@#$Foo0987'.slugify).to eq 'foo0987'
|
235
|
+
expect('!@#$%^'.slugify).to eq nil
|
236
|
+
# make sure we're not performing in place
|
237
|
+
str = 'FooBarBaz'
|
238
|
+
expect(str.slugify).to eq 'foo-bar-baz'
|
239
|
+
expect(str).to eq 'FooBarBaz'
|
240
|
+
|
241
|
+
# we permit leading numbers, unlike keyify
|
242
|
+
expect('!1234FooBAR'.slugify).to eq '1234-foo-bar'
|
243
|
+
expect('1234FooBAR'.slugify).to eq '1234-foo-bar'
|
244
|
+
expect('12345678'.slugify).to eq '12345678'
|
245
|
+
|
246
|
+
# should work on frozen values
|
247
|
+
expect('FooBarBaz'.freeze.slugify).to eq 'foo-bar-baz'
|
248
|
+
end
|
249
|
+
|
250
|
+
it '#slugify!' do
|
251
|
+
slugify_sets.each do |set|
|
252
|
+
inc, out = set
|
253
|
+
expect(inc.slugify!).to eq out
|
254
|
+
end
|
255
|
+
expect{ '!@#$%^'.slugify! }.to raise_error(ArgumentError)
|
256
|
+
expect{ '12345678'.slugify! }.not_to raise_error
|
257
|
+
end
|
258
|
+
|
259
|
+
it '#to_uuid' do
|
260
|
+
str = "5062754996b140c8b5dde7ffc23376a1"
|
261
|
+
expect(str.to_uuid).to eq "50627549-96b1-40c8-b5dd-e7ffc23376a1"
|
262
|
+
# too long
|
263
|
+
expect{ (str + '1').to_uuid }.to raise_error(ArgumentError)
|
264
|
+
# not hex
|
265
|
+
expect{ (str[0,31] + 'k').to_uuid }.to raise_error(ArgumentError)
|
266
|
+
# just bad
|
267
|
+
expect{ ("just some writing 123!").to_uuid }.to raise_error(ArgumentError)
|
268
|
+
|
269
|
+
formatted_uuid = "5a658838-7aa4-488c-98f1-21805a5d2021"
|
270
|
+
expect(formatted_uuid.to_uuid).to eq formatted_uuid
|
271
|
+
# Only dashes are accepted as separators
|
272
|
+
expect{ formatted_uuid.gsub('-', ' ').to_uuid }.to raise_error(ArgumentError)
|
273
|
+
expect{ formatted_uuid.gsub('-', '.').to_uuid }.to raise_error(ArgumentError)
|
274
|
+
|
275
|
+
random_uuid = SecureRandom.uuid
|
276
|
+
no_dashes = random_uuid.delete('-')
|
277
|
+
expect(no_dashes.to_uuid).to eq random_uuid
|
278
|
+
end
|
279
|
+
|
280
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finishing_moves
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Koehl
|
@@ -9,22 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-08-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: rb-readline
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '0'
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '0'
|
28
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: rspec
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,34 +25,6 @@ dependencies:
|
|
39
25
|
- - "~>"
|
40
26
|
- !ruby/object:Gem::Version
|
41
27
|
version: 3.1.0
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: priscilla
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: pry-byebug
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
28
|
- !ruby/object:Gem::Dependency
|
71
29
|
name: fuubar
|
72
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,16 +45,21 @@ dependencies:
|
|
87
45
|
requirements:
|
88
46
|
- - ">="
|
89
47
|
- !ruby/object:Gem::Version
|
90
|
-
version: 0
|
48
|
+
version: '0'
|
91
49
|
type: :development
|
92
50
|
prerelease: false
|
93
51
|
version_requirements: !ruby/object:Gem::Requirement
|
94
52
|
requirements:
|
95
53
|
- - ">="
|
96
54
|
- !ruby/object:Gem::Version
|
97
|
-
version: 0
|
98
|
-
description:
|
99
|
-
|
55
|
+
version: '0'
|
56
|
+
description: ' Ruby includes a huge amount of default awesomeness that tackles
|
57
|
+
most common development challenges. But every now and then, you find yourself performing
|
58
|
+
contortions to achieve results that, honestly, should feel more natural given the
|
59
|
+
language''s design elegance. Finishing Moves is a collection of methods designed
|
60
|
+
to assist in those "why is this awkward?" scenarios.
|
61
|
+
|
62
|
+
'
|
100
63
|
email:
|
101
64
|
- frank@forgecrafted.com
|
102
65
|
- chris@forgecrafted.com
|
@@ -148,15 +111,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
111
|
requirements:
|
149
112
|
- - ">="
|
150
113
|
- !ruby/object:Gem::Version
|
151
|
-
version: 2.
|
114
|
+
version: 2.7.0
|
152
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
116
|
requirements:
|
154
117
|
- - ">="
|
155
118
|
- !ruby/object:Gem::Version
|
156
119
|
version: '0'
|
157
120
|
requirements: []
|
158
|
-
|
159
|
-
rubygems_version: 2.4.5
|
121
|
+
rubygems_version: 3.3.7
|
160
122
|
signing_key:
|
161
123
|
specification_version: 4
|
162
124
|
summary: Small, focused, incredibly useful methods added to core Ruby classes.
|