tramway 0.2.1 → 0.2.1.2

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
  SHA256:
3
- metadata.gz: 4278abe2405f3788a77844c7bd0bb6afe25e8f14feb8d2587b5c7c4ce2d8563f
4
- data.tar.gz: 68872e25d9a868ea13cd791f060a2bc0fad80bc31e5cae6c7d071e1cbfd5ed05
3
+ metadata.gz: e2dd99c95cb679606a69128eb290b9c35fee411dc626ed2f43a1b3cfcba36efa
4
+ data.tar.gz: 95ed3ccb11b51c8df14061aa9bc483257da99e05755f06935fd27bfabb3d1393
5
5
  SHA512:
6
- metadata.gz: 6195c4bb13401cfd3b0d518fd4952f53f0e0cfab13f9fc1ede6bcf9a17b52e7d966773635fcd718b5ce71cad18f6632c858ef183a110c12b10957cbce684b5f1
7
- data.tar.gz: f7b12ede11f475da4f441cefd5ca7e91cb1d6df4e7fb51d489b88f30f37917ba6d3cadecda826a49d8559ecc92d93c7ad94e049f8b48d226c247ed920bb808cf
6
+ metadata.gz: d759138c8522fa61b234affae4547f403992ade47ff99413e5abb42cc52101137294dcef77e4f17528d1d6463d8668fa85ef71cd1b0bc6f5042522aa8254fd27
7
+ data.tar.gz: 2e63cf0b4fa9122c2f0e97aaad067a7b325c5644a4912c1636f4bc247e1f98dada96991ed231c1ab26d404dec0d719c406bacede57e21331576fbb005fdabf9d
@@ -22,7 +22,11 @@ module Tramway
22
22
  class << self
23
23
  def decorate(object_or_array, context)
24
24
  if Tramway::Decorators::CollectionDecorators.collection?(object_or_array)
25
- Tramway::Decorators::CollectionDecorators.decorate_collection(collection: object_or_array, context:)
25
+ Tramway::Decorators::CollectionDecorators.decorate_collection(
26
+ collection: object_or_array,
27
+ context:,
28
+ decorator: self
29
+ )
26
30
  else
27
31
  new(object_or_array, context)
28
32
  end
@@ -7,9 +7,9 @@ module Tramway
7
7
  module CollectionDecorators
8
8
  module_function
9
9
 
10
- def decorate_collection(collection:, context:)
10
+ def decorate_collection(collection:, context:, decorator:)
11
11
  collection.map do |item|
12
- Tramway::Decorators::BaseDecorator.decorate item, context
12
+ decorator.decorate item, context
13
13
  end
14
14
  end
15
15
 
@@ -8,6 +8,8 @@ module Tramway
8
8
  #
9
9
  module DecorateHelper
10
10
  def tramway_decorate(object_or_array, decorator: nil)
11
+ return [] if Tramway::Decorators::CollectionDecorators.collection?(object_or_array) && object_or_array.empty?
12
+
11
13
  Tramway::Decorators::ClassHelper.decorator_class(object_or_array, decorator).decorate object_or_array, self
12
14
  end
13
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kalashnikovisme
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-07-01 00:00:00.000000000 Z
12
+ date: 2023-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml-rails