tramway 0.3.1.1 → 0.3.1.2

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: afc672cadc5513d98dce14491b39bc240f08019a61bd19ff795ca9ee2cd4cefd
4
- data.tar.gz: 10d6bb6bb570855763921365260899b1da88c36a7e0eb102b784331d6e4c2021
3
+ metadata.gz: 0becd1c6b67984097bf36b6e6a2180792863ded76f5e28174ea213e3f5f85ddd
4
+ data.tar.gz: a74d5284069e8fa7c162b5c1dce27ba3fc85bb3558c0c934527b2365ab37bf8d
5
5
  SHA512:
6
- metadata.gz: a27d64991c18ad3ef69dd1ef660a9b743e4f5e481bfd46dbd9aea4e56651b576d161f932f9eaf5bb249a5e7bcad1c2f6c5bc13b5ad8e6307c3e032a020216058
7
- data.tar.gz: 64cf301904e00cb8c0b9504fc6081f8cecc21262426d309e55d8046d6d26887f06e9d3841e82dcd40a8d53fd4f8e0f9b407e40413bdd38fb2931790c770f6777
6
+ metadata.gz: 45a89fec8a66c5e33f3321d18dfb7971bb0fe52f2c1984b86958453364af2c7327d8fba8a80a36f83e3cb40aa93da5aae2cd2b319658dbf1ca21cea122375692
7
+ data.tar.gz: e3087975aa2d174982434340b32964c39817c7a95baabbb0f912c54dbfda682e3c1270d6600896ac5ff9ad94c0bebbba59de4ea724933b96c2a1cb95efcb0861
data/README.md CHANGED
@@ -101,6 +101,15 @@ def show
101
101
  end
102
102
  ```
103
103
 
104
+ #### Decorate nil
105
+
106
+ Tramway Decorator does not decorate nil objects
107
+
108
+ ```ruby
109
+ user = nil
110
+ UserDecorator.decorate user # => nil
111
+ ```
112
+
104
113
  ### Tramway Form
105
114
 
106
115
  Tramway provides **convenient** form objects for Rails applications. List properties you want to change and the rules in Form classes. No controllers overloading.
@@ -17,7 +17,10 @@ module Tramway
17
17
  end
18
18
 
19
19
  class << self
20
+ # :reek:NilCheck { enabled: false } because checking for nil is not a type-checking issue but business logic
20
21
  def decorate(object_or_array)
22
+ return if object_or_array.nil?
23
+
21
24
  if Tramway::Decorators::CollectionDecorators.collection?(object_or_array)
22
25
  Tramway::Decorators::CollectionDecorators.decorate_collection(
23
26
  collection: object_or_array,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '0.3.1.1'
4
+ VERSION = '0.3.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.3.1.1
4
+ version: 0.3.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-12-01 00:00:00.000000000 Z
12
+ date: 2023-12-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-struct