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 +4 -4
- data/lib/tramway/base_decorator.rb +2 -0
- data/lib/tramway/helpers/decorate_helper.rb +3 -0
- data/lib/tramway/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e496f3ab6336d7f29b0b0021ef04b2bc18353ca3049406dd59671fbb8638d48f
|
4
|
+
data.tar.gz: 7863120a81d6195f4e60bcae4d24a43845a6a184621bfe10ecc4dfcb8c83ff4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/tramway/version.rb
CHANGED
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.
|
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-
|
12
|
+
date: 2024-08-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dry-struct
|