abstracts 1.0.8 → 1.0.9
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 +4 -4
- data/lib/abstracts.rb +6 -5
- data/spec/abstracts_spec.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0475ce0a6ce2d505e9dc0bb0e1f56e5433b63cfe
|
4
|
+
data.tar.gz: 6f67ea481b2b12efda97ac624a868d086fa6ebb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0982e74ed3b020842984a2e84a460f6e5a2006a8743cfe375187da8222622f8d32183d6672261d3459c90a470fe27cf0411f83e7cdd6a5b1e3ea02731b00508
|
7
|
+
data.tar.gz: def83127fcc5626941dfcd2ef7bc0b8b56f1c95aadd47487b60d75656b7c8dd940033e591e4274ed3726dd57bc87fd4fd26992f3ed2434ff9d3de27747453a6c
|
data/lib/abstracts.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
# Abstract module
|
2
2
|
module Abstract
|
3
|
+
# Extensions
|
3
4
|
module Extensions
|
4
|
-
|
5
|
+
# Object extensions
|
6
|
+
module Object
|
5
7
|
# Check if object is blank
|
6
8
|
# @return [Trueclass, FalseClass] - is object nil or empty
|
7
9
|
def blank?
|
8
10
|
begin
|
9
11
|
return true if nil? || empty?
|
10
|
-
rescue
|
12
|
+
rescue StandardError
|
11
13
|
false
|
12
14
|
end
|
13
15
|
false
|
@@ -26,9 +28,8 @@ module Abstract
|
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
29
|
-
|
30
|
-
|
31
|
-
|
31
|
+
end
|
32
|
+
|
32
33
|
# Abstract::Builder class
|
33
34
|
class Builder
|
34
35
|
attr_reader :object
|
data/spec/abstracts_spec.rb
CHANGED
@@ -5,19 +5,19 @@ describe '.blank?' do
|
|
5
5
|
|
6
6
|
context 'when self = String.new' do
|
7
7
|
it 'String.new.blank? expected to be true' do
|
8
|
-
expect(
|
8
|
+
expect(''.blank?).to eq true
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
context 'when self = Hash.new' do
|
13
13
|
it 'Hash.new.blank? expected to be true' do
|
14
|
-
expect(
|
14
|
+
expect({}.blank?).to eq true
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
context 'when self = Array.new' do
|
19
19
|
it 'Array.new.blank? expected to be true' do
|
20
|
-
expect(
|
20
|
+
expect([].blank?).to eq true
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -29,7 +29,7 @@ describe '.blank?' do
|
|
29
29
|
|
30
30
|
context "when self = {qwe: 'rty'}" do
|
31
31
|
it "{foo: 'bar'}.blank? expected to be false" do
|
32
|
-
expect({foo: 'bar'}.blank?).to eq false
|
32
|
+
expect({ foo: 'bar' }.blank?).to eq false
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -38,7 +38,7 @@ describe '.blank?' do
|
|
38
38
|
expect(%w[foo bar].blank?).to eq false
|
39
39
|
end
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
context 'when self = Hash' do
|
43
43
|
it 'Hash.blank? expected to be false' do
|
44
44
|
expect(Hash.blank?).to eq false
|