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: 62e25eddc0fd59750f4eb166fe3cc3b9b70bde690bc203452749aa3c9961a5ee
4
- data.tar.gz: 40dc524a36e3de7b399d1d3453b57a38a8ce52bceebe681fcf160c2590449fd2
3
+ metadata.gz: 36281ca342f1bff8e10b7eb8b9ae700364801866eac0b49490ed9aa7ee8aca65
4
+ data.tar.gz: 2832c943eebfb05c20854f095f546a9547e58c1b4cefa375267190a064c82abd
5
5
  SHA512:
6
- metadata.gz: 1e09f2db0575da0e803ed76c5bd162416e91c15d9c308252d0aa1dc7e7cb85fd3e08bfeb253c95346e2780b3c5987710d07b71f89cecf858ca8b5c433339d5d9
7
- data.tar.gz: 3251732d5e69e2f3da4260ce95988a0e647f978234785ff6d3a445d59541155f917d28a3e19efb00eea14bfe53f7432eb42b1c2517cfc32a66fd629558ebf30a
6
+ metadata.gz: a058b0e162b9127c8e73ecf20c52734e2dd8fa4e0e6954ef6b90df9a6ea687c12033a5f7d7b02cd979c796f5dfe67691c6ac066b07f4b15810be10d6a0672066
7
+ data.tar.gz: 21545385d0ad010d493c15edb6da7a6af9df8f92ff1cf2059d2c99160e5d0f735773004cf16294bcaf67996f025a542d2590e1dc0afedfd841c0aec8333a43bb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ree_lib (1.0.116)
4
+ ree_lib (1.0.117)
5
5
  bigdecimal (~> 3.1.6)
6
6
  binding_of_caller (~> 1.0.0)
7
7
  i18n (~> 1.14.1)
@@ -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")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReeLib
4
- VERSION = "1.0.116"
4
+ VERSION = "1.0.117"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ree_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.116
4
+ version: 1.0.117
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov