tramway 0.4.7 → 0.4.8

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: 69d16412bfd7e8fcb33e3ddc27a8be714350cd7fe97a56451a47dced641546c7
4
- data.tar.gz: 60d32317870e16a0e4aadc618a8a2170939fda2e7d06d7202935a40d1ee945f7
3
+ metadata.gz: e496f3ab6336d7f29b0b0021ef04b2bc18353ca3049406dd59671fbb8638d48f
4
+ data.tar.gz: 7863120a81d6195f4e60bcae4d24a43845a6a184621bfe10ecc4dfcb8c83ff4c
5
5
  SHA512:
6
- metadata.gz: a31a8b31885e7bf84aed5896850e7e98930fcf7bdf5dcc74eaf006172b7d6f305458f79c659618ac8da82d2050d18b818a891ac93ef1ff4bf01a5fe20cf8dabc
7
- data.tar.gz: f21ecdb0d87afb50afae3c3b5a01d953f3736778fad9f0e47e2b16e8a1d35b33002ef4bf96b1624af20e2aaa619d90c7195b1ed225bad68279e211dbf795f6f7
6
+ metadata.gz: 374c6d983df5d172bf08e9f33fecb37abe192e4e6b8fd0a8863c3cd367f77206238abf05edfa7c0501919c860d90ee790fa16be721bc4c70adb2ad51245170fe
7
+ data.tar.gz: 6876ad8aef86197b3b56c64cc07eddfcc9943aaa504d20b3d970d55e2fe197df16d6b5d28876d63cee75bca26e287fcc2ed078e3e420c5958607eac27fe78abe
@@ -3,6 +3,7 @@
3
3
  require 'tramway/decorators/name_builder'
4
4
  require 'tramway/decorators/association'
5
5
  require 'tramway/decorators/collection_decorator'
6
+ require 'tramway/helpers/decorate_helper'
6
7
  require 'tramway/utils/render'
7
8
  require 'tramway/duck_typing'
8
9
 
@@ -13,6 +14,7 @@ module Tramway
13
14
  include Tramway::Decorators::CollectionDecorators
14
15
  include Tramway::Utils::Render
15
16
  include Tramway::DuckTyping::ActiveRecordCompatibility
17
+ include Tramway::Helpers::DecorateHelper
16
18
 
17
19
  attr_reader :object
18
20
 
@@ -7,9 +7,12 @@ module Tramway
7
7
  # Provides methods into Rails ActionController
8
8
  #
9
9
  module DecorateHelper
10
+ # :reek:NilCheck { enabled: false } because checking for nil is not a type-checking issue but business logic
10
11
  def tramway_decorate(object_or_array, decorator: nil)
11
12
  return [] if Tramway::Decorators::CollectionDecorators.collection?(object_or_array) && object_or_array.empty?
12
13
 
14
+ return if object_or_array.nil?
15
+
13
16
  Tramway::Decorators::ClassHelper.decorator_class(object_or_array, decorator).decorate object_or_array
14
17
  end
15
18
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '0.4.7'
4
+ VERSION = '0.4.8'
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.4.7
4
+ version: 0.4.8
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: 2024-07-04 00:00:00.000000000 Z
12
+ date: 2024-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-struct