yuba 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -2
- data/lib/yuba/service.rb +20 -0
- data/lib/yuba/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 017f6300c8cb0d9867119b0e186af6d285b385abec945a23f7745648e140d709
|
4
|
+
data.tar.gz: 5c67a6522565be8935e10413298640755037ed516d30105a53bb1d1bfbf30da7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34d21d868256f97cf550ff18a6adb20c6ed2a46c923979ef933966c13b79503835b9db16c4df86c7cb327506dcf240c72e437bc9541e9f8548d086e6dfa58e09
|
7
|
+
data.tar.gz: 14579a01e26e0916eb2a199ed0fc182d6902130b9ad5e9cacf35700bfd1f085d0ab4d8652bbf71bedfdd108ac97d13a43f2c71ac315c07c5acd82fb9eb466e5b
|
data/README.md
CHANGED
@@ -35,8 +35,8 @@ $ bundle install
|
|
35
35
|
|
36
36
|
## Support
|
37
37
|
|
38
|
-
- Rails
|
39
|
-
- Ruby 2.
|
38
|
+
- Rails 5.2+
|
39
|
+
- Ruby 2.5+
|
40
40
|
|
41
41
|
## ViewModel
|
42
42
|
|
@@ -154,6 +154,17 @@ end
|
|
154
154
|
- `.call` invokes `#call` after assigning arguments as properties.
|
155
155
|
- `#success?` returns `true` if you don't invoke `#fail!`
|
156
156
|
|
157
|
+
You have inspection methods for properties.
|
158
|
+
|
159
|
+
```ruby
|
160
|
+
service = CreatePostService.new(user: someuser)
|
161
|
+
service.has_property?(:user) #=> true
|
162
|
+
service.has_public_property?(:user) #=> true
|
163
|
+
service.has_private_property?(:user) #=> false
|
164
|
+
service.has_required_property?(:user) #=> true
|
165
|
+
service.has_optional_property?(:user) #=> false
|
166
|
+
```
|
167
|
+
|
157
168
|
## Form
|
158
169
|
|
159
170
|
Form is just wrapper of [reform-rails](https://github.com/trailblazer/reform-rails) for now.
|
data/lib/yuba/service.rb
CHANGED
@@ -37,6 +37,26 @@ module Yuba
|
|
37
37
|
!@_success
|
38
38
|
end
|
39
39
|
|
40
|
+
def has_property?(property)
|
41
|
+
_properties.has_key?(property.to_sym)
|
42
|
+
end
|
43
|
+
|
44
|
+
def has_required_property?(property)
|
45
|
+
has_property?(property) && !_properties.dig(property.to_sym, :optional)
|
46
|
+
end
|
47
|
+
|
48
|
+
def has_optional_property?(property)
|
49
|
+
has_property?(property) && !has_required_property?(property)
|
50
|
+
end
|
51
|
+
|
52
|
+
def has_public_property?(property)
|
53
|
+
has_property?(property) && !has_private_property?(property)
|
54
|
+
end
|
55
|
+
|
56
|
+
def has_private_property?(property)
|
57
|
+
has_property?(property) && !_properties.dig(property.to_sym, :public)
|
58
|
+
end
|
59
|
+
|
40
60
|
private
|
41
61
|
|
42
62
|
def validate_arguments(args)
|
data/lib/yuba/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yuba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- willnet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
requirements: []
|
182
|
-
rubygems_version: 3.1.
|
182
|
+
rubygems_version: 3.1.6
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: Add New Layers to Rails
|