lhs 13.2.2 → 13.2.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 +4 -4
- data/lib/lhs/pagination/base.rb +4 -6
- data/lib/lhs/version.rb +1 -1
- data/spec/data/collection_spec.rb +15 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bda2ff4ae84ce367ee21ad8922b46e600b288c5
|
4
|
+
data.tar.gz: c8fc0746ffca39f2b7e5ad370ba71cc884535ec9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e298a06e35a61cdbaddbceffc23e7e982e4387b9d21c7753165202e309bc0e463339b511039abf20c3038c389460e4676ef2ce933a285b83cb53b6543ffb180b
|
7
|
+
data.tar.gz: d2020691e22febd3f22256c2f689d093e65fd92fb0bb5519ff5413905f54f6a946fe5ce8cbb83ba9b2681322033f7f93ec26f50c4eba56b19e92cb580b267c1c
|
data/lib/lhs/pagination/base.rb
CHANGED
@@ -11,15 +11,13 @@ module LHS::Pagination
|
|
11
11
|
self.data = data
|
12
12
|
end
|
13
13
|
|
14
|
-
# as standard in Rails' ActiveRecord count is not summing up, but using the number provided from data source
|
15
|
-
def count
|
16
|
-
total
|
17
|
-
end
|
18
|
-
|
19
14
|
def total
|
20
|
-
data._raw.dig(*_record.total_key)
|
15
|
+
data._raw.dig(*_record.total_key) || 0
|
21
16
|
end
|
22
17
|
|
18
|
+
# as standard in Rails' ActiveRecord count is not summing up, but using the number provided from data source
|
19
|
+
alias count total
|
20
|
+
|
23
21
|
def limit
|
24
22
|
data._raw.dig(*_record.limit_key) || DEFAULT_LIMIT
|
25
23
|
end
|
data/lib/lhs/version.rb
CHANGED
@@ -15,6 +15,21 @@ describe LHS::Data do
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
context 'empty collection' do
|
19
|
+
let(:collection) do
|
20
|
+
LHS::Data.new({ items: [] }, nil, Record)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'provides correct count and length' do
|
24
|
+
expect(collection.count).to eq 0
|
25
|
+
expect(collection.length).to eq 0
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'returns an empty array or map' do
|
29
|
+
expect(collection.map { |x| }).to eq []
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
18
33
|
context 'collections' do
|
19
34
|
it 'forwards calls to the collection' do
|
20
35
|
expect(data.count).to be_kind_of Integer
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lhs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 13.2.
|
4
|
+
version: 13.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/local-ch/lhs/graphs/contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lhc
|
@@ -417,7 +417,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
417
417
|
requirements:
|
418
418
|
- Ruby >= 2.3.0
|
419
419
|
rubyforge_project:
|
420
|
-
rubygems_version: 2.6.
|
420
|
+
rubygems_version: 2.6.8
|
421
421
|
signing_key:
|
422
422
|
specification_version: 4
|
423
423
|
summary: Rails gem providing an easy, active-record-like interface for http json services
|