yuba 0.0.8 → 0.0.9

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: 5194de3e17a63c28eea57ebb3d33e4a8ae03fae8a4433bcaad3514110586de2b
4
- data.tar.gz: a85114bd871291f3436afae4c878f07fcfbd7e713e26c42439a21c975278efda
3
+ metadata.gz: 972ae9498c1bcea0f825f330d594b94ec00d487f8369faeab51ccf72cd95ecf9
4
+ data.tar.gz: 907c054c3471e936f6c4665971dc6e555b93ea83586c606ab0b971ade8842ffd
5
5
  SHA512:
6
- metadata.gz: b3e1cd7e45ac09787b546db39fea103c4d396a8d2ca33df494e6d475291e954a03ecbda027039292fdf4f41782238dc3d0fb3f329fc84f40a7c0810fc5831942
7
- data.tar.gz: fbb40d7809090a4ed252d4c801939e354fb0b6b7051be9b7c9860aba81fac9bdcdcefcf7be5fd02ae4a97832a3dcb06c803d061e48498edb03cace5997812f97
6
+ metadata.gz: 4944859716ce1cd8b5771cacfb1d718b019bf69cdaf54ffa81c52c4a70a86fc69ed648da1b8fc252ce176d1a9ec6e87eb7aeada7f37a86f85c8f86e86aa2f49f
7
+ data.tar.gz: 3d94063165609298b2dda4e15dfd5e96505b38f5fde9008da3443a437ae69a6437a0ad7d3b9633ea80e9c48e7c89e8179c73e389d947983cae543456292c9776
data/README.md CHANGED
@@ -5,19 +5,18 @@
5
5
 
6
6
  ## warning
7
7
 
8
- Version of this gem is now 0.0.x. It works but there must be occasional breaking changes to the API.
8
+ The version of this gem is now 0.0.x. It works, but there must be occasional breaking changes to the API.
9
9
 
10
10
  ## Summary
11
11
 
12
- Yuba add new layers to rails.
12
+ Yuba adds new layers to rails.
13
13
 
14
14
  - Service
15
15
  - Form
16
16
  - ViewModel
17
17
 
18
- It is convenient to use them in combination, but you can use them even by themselves.
19
-
20
- If you have difficulties with large rails application, Yuba help you.
18
+ It is convenient to use them in combination, but you can use them even individually.
19
+ If you have difficulties with a large rails application, Yuba helps you.
21
20
 
22
21
  ## Installation
23
22
 
@@ -40,7 +39,7 @@ $ bundle install
40
39
 
41
40
  ## ViewModel
42
41
 
43
- ViewModel is useful when there are many instance variables in controller.
42
+ ViewModel is useful when there are many instance variables in controllers.
44
43
 
45
44
  ```ruby
46
45
  class PostViewModel < Yuba::ViewModel
@@ -69,15 +68,15 @@ view.post #=> NoMethodError
69
68
 
70
69
  ### property
71
70
 
72
- `.property` method register property to the class.
71
+ `.property` method registers property to the class.
73
72
 
74
- Those registered by property need to be passed as arguments to the `initialize` except when `optional: true` is attached. You get ArgumentError if you don't pass `property` to `initialize`.
73
+ We need to pass those properties as arguments to the `initialize` except when `optional: true` is attached. You get ArgumentError if you don't pass `property` to `initialize`.
75
74
 
76
- Property is default to private. This means you can use it in internal the instance. If you want to use it as public, use `public: true` option.
75
+ Property is default to private. It means you can use it in the internal instance. If you want to use it as public, use `public: true` option.
77
76
 
78
77
  ### Auto Assign
79
78
 
80
- You can use ViewModel in a controller like following
79
+ You can use ViewModel in a controller like the following.
81
80
 
82
81
  ```ruby
83
82
  class PostsController < ApplicationController
@@ -98,11 +97,11 @@ class PostsController < ApplicationController
98
97
  end
99
98
  ```
100
99
 
101
- view_model option of render takes ViewModel, which get it's public methods (include public property) and assign them to instance variables in view template. So you can write `<%= @post.title %>` instead of `<%= @view_model.post.title %>`
100
+ view_model option of render takes ViewModel, which gets its public methods (include public property) and assigns them to instance variables in the view template. So you can write `<%= @post.title %>` instead of `<%= @view_model.post.title %>`
102
101
 
103
102
  ## Service
104
103
 
105
- Service is useful when controller has many application logic.
104
+ Service is valuable when a controller has many application logic.
106
105
 
107
106
  ```ruby
108
107
  class PostController < ApplicationController
@@ -150,7 +149,7 @@ class CreatePostService < Yuba::Service
150
149
  end
151
150
  ```
152
151
 
153
- - `.property` method register property to the class like ViewModel.
152
+ - `.property` method registers property to the class like ViewModel.
154
153
  - `.call` invokes `#call` after assigning arguments as properties.
155
154
  - `#success?` returns `true` if you don't invoke `#fail!`
156
155
 
@@ -243,7 +242,7 @@ rails generate yuba:view_model artist_index
243
242
 
244
243
  ## Contributing
245
244
 
246
- You can try to test by doing as following
245
+ You can try to test by doing as following.
247
246
 
248
247
  ```
249
248
  git clone https://github.com/willnet/yuba.git
@@ -4,7 +4,7 @@ module Yuba
4
4
  class Form < ::Reform::Form
5
5
  module Coercion
6
6
  module Types
7
- include Dry::Types.module
7
+ include Dry.Types
8
8
  end
9
9
 
10
10
  module ClassMethods
@@ -17,7 +17,7 @@ module Yuba
17
17
 
18
18
  def coercing_setter!(name, type)
19
19
  class_name = type.to_s.classify
20
- type_class = "Yuba::Form::Coercion::Types::Form::#{class_name}".constantize
20
+ type_class = "Yuba::Form::Coercion::Types::Params::#{class_name}".constantize
21
21
 
22
22
  mod = Module.new do
23
23
  define_method("#{name}=") do |value|
@@ -16,7 +16,7 @@ module Yuba::Form::MultiParameterAttributes
16
16
  params.delete("#{date_attribute}(3i)"),
17
17
  params.delete("#{date_attribute}(4i)"),
18
18
  params.delete("#{date_attribute}(5i)")
19
- )
19
+ ).to_s
20
20
  end
21
21
  end
22
22
 
data/lib/yuba/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yuba
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
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.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - willnet
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-26 00:00:00.000000000 Z
11
+ date: 2022-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: dry-types
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.12.2
47
+ version: '1.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.12.2
54
+ version: '1.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sqlite3
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -164,7 +164,7 @@ homepage: https://github.com/willnet/yuba
164
164
  licenses:
165
165
  - MIT
166
166
  metadata: {}
167
- post_install_message:
167
+ post_install_message:
168
168
  rdoc_options: []
169
169
  require_paths:
170
170
  - lib
@@ -179,8 +179,8 @@ 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.6
183
- signing_key:
182
+ rubygems_version: 3.2.33
183
+ signing_key:
184
184
  specification_version: 4
185
185
  summary: Add New Layers to Rails
186
186
  test_files: []