flyer 1.1.0 → 1.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a7568cd9041ad77ced29000063f89ef9c815b0b
4
- data.tar.gz: 24e968c8a2f0739f595476775ac26e1b5540e915
3
+ metadata.gz: c3c6be37a754de57e7de456243de89e5b30e8159
4
+ data.tar.gz: 877d95f47b43563d38aa76d726097d3875cea4af
5
5
  SHA512:
6
- metadata.gz: bd8a855af7c0f95eecdfc2e061eecee65a8cf3dedfb93c93ed5fc364289cc0ba7bd0066940776d107191446817facf65c5d7fdc4107ea7e765b1b57cff61962c
7
- data.tar.gz: 154b49afab88694817a2ae3ff154f310fd77209a30d1f59c16130582dac91bde41c42ed1d731391b8d925b0a465f8d0ab6640ac7c638f2262941f30fc3ece028
6
+ metadata.gz: e36b822ecb35b83ab43e30ce782f6c11d3bbb39923d001233306477d626047098ebc0ed3051d574e73efe00c336b94567a78810665446133e7aac4a08fbe69ae
7
+ data.tar.gz: 2332f60800af1e4f9bf63f1f55bfe50960716920e3cc781d8597cc9705a63ad805e112c2f6df6cf5dd2c95cb8fa1659513311956229cc203d71c2ea4cf0fea19
@@ -4,12 +4,15 @@ module Flyer::ControllerAdditions
4
4
  #
5
5
  def notifications
6
6
  @notifications ||= begin
7
+ limit = Flyer.settings.max_notifications ||
8
+ Flyer::Notification.notifications.count
9
+
7
10
  found_notifications = []
8
- Flyer::Notification.notifications.each do |n|
11
+ Flyer::Notification.notifications.each_with_index do |n, index|
9
12
  notification = Flyer::Notification.new(self)
10
13
  n.call(notification)
11
14
  notification.validate!
12
- if notification.visible?
15
+ if notification.visible? and index < limit
13
16
  notification.used!
14
17
  found_notifications << notification.view
15
18
  end
@@ -20,11 +23,6 @@ module Flyer::ControllerAdditions
20
23
  raise Flyer::FoundNonUniqueIds.new
21
24
  end
22
25
 
23
- #
24
- if limit = Flyer.settings.max_notifications
25
- found_notifications = found_notifications.take(limit)
26
- end
27
-
28
26
  found_notifications
29
27
  end
30
28
  end
data/lib/flyer/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Flyer
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flyer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Linus Oleander