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 +4 -4
- data/README.md +9 -0
- data/lib/tramway/base_decorator.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: 0becd1c6b67984097bf36b6e6a2180792863ded76f5e28174ea213e3f5f85ddd
|
4
|
+
data.tar.gz: a74d5284069e8fa7c162b5c1dce27ba3fc85bb3558c0c934527b2365ab37bf8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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.3.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-
|
12
|
+
date: 2023-12-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dry-struct
|