ree_lib 1.0.116 → 1.0.117
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36281ca342f1bff8e10b7eb8b9ae700364801866eac0b49490ed9aa7ee8aca65
|
4
|
+
data.tar.gz: 2832c943eebfb05c20854f095f546a9547e58c1b4cefa375267190a064c82abd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a058b0e162b9127c8e73ecf20c52734e2dd8fa4e0e6954ef6b90df9a6ea687c12033a5f7d7b02cd979c796f5dfe67691c6ac066b07f4b15810be10d6a0672066
|
7
|
+
data.tar.gz: 21545385d0ad010d493c15edb6da7a6af9df8f92ff1cf2059d2c99160e5d0f735773004cf16294bcaf67996f025a542d2590e1dc0afedfd841c0aec8333a43bb
|
data/Gemfile.lock
CHANGED
@@ -2,9 +2,12 @@ class ReeDto::CollectionFilter
|
|
2
2
|
include Ree::Contracts::Core
|
3
3
|
include Ree::Contracts::ArgContracts
|
4
4
|
include Enumerable
|
5
|
+
extend Forwardable
|
5
6
|
|
6
7
|
InvalidFilterItemErr = Class.new(ArgumentError)
|
7
8
|
|
9
|
+
def_delegators *([:all] + Array.public_instance_methods - Object.public_instance_methods)
|
10
|
+
|
8
11
|
contract Any, Symbol, Proc => Any
|
9
12
|
def initialize(collection, name, filter_proc)
|
10
13
|
@collection = collection
|
@@ -17,17 +20,16 @@ class ReeDto::CollectionFilter
|
|
17
20
|
@collection.select(&@filter_proc).each(&block)
|
18
21
|
end
|
19
22
|
|
23
|
+
def all
|
24
|
+
@collection.select(&@filter_proc)
|
25
|
+
end
|
26
|
+
|
20
27
|
contract Any => Any
|
21
28
|
def add(item)
|
22
29
|
check_item(item)
|
23
30
|
@collection.add(item)
|
24
31
|
end
|
25
32
|
|
26
|
-
contract None => Integer
|
27
|
-
def size
|
28
|
-
count
|
29
|
-
end
|
30
|
-
|
31
33
|
def inspect
|
32
34
|
to_a.inspect
|
33
35
|
end
|
@@ -122,6 +122,8 @@ RSpec.describe ReeDto::DSL do
|
|
122
122
|
dto.users.active << peter
|
123
123
|
|
124
124
|
expect(dto.users.size).to eq(3)
|
125
|
+
expect(dto.users.active.empty?).to eq(false)
|
126
|
+
expect(dto.users.active.size).to eq(2)
|
125
127
|
|
126
128
|
expect {
|
127
129
|
dto.users.active << ReeDto::DtoClass::User.new(1, "John", "inactive")
|
data/lib/ree_lib/version.rb
CHANGED