yuba 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5194de3e17a63c28eea57ebb3d33e4a8ae03fae8a4433bcaad3514110586de2b
4
- data.tar.gz: a85114bd871291f3436afae4c878f07fcfbd7e713e26c42439a21c975278efda
3
+ metadata.gz: 923693afd2fa30ad21452e8d2295cfec6d1698cbed280cd11f08679c6640ff59
4
+ data.tar.gz: 736e4fdc15efec3f057a2d4237db9ee99691f1be6b2aed17391e6e4c724deea2
5
5
  SHA512:
6
- metadata.gz: b3e1cd7e45ac09787b546db39fea103c4d396a8d2ca33df494e6d475291e954a03ecbda027039292fdf4f41782238dc3d0fb3f329fc84f40a7c0810fc5831942
7
- data.tar.gz: fbb40d7809090a4ed252d4c801939e354fb0b6b7051be9b7c9860aba81fac9bdcdcefcf7be5fd02ae4a97832a3dcb06c803d061e48498edb03cace5997812f97
6
+ metadata.gz: 05dde5e15d1836e9bcab002af720040c9b75d4f3bcc7b14b594fb29b7746687d7c8db17abea820bd0e239f96f5ac73546c896e28c97a19dce09fa997c1810b44
7
+ data.tar.gz: 1e06dac425ae8c4231e8bddac55b19caa00aac8f642cc9297ab8a0b16fb13aa21be8bda8f7524beefde13f7f07ef92bbc6e6053266054c6a2093778e4a834eed
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
 
@@ -35,12 +34,12 @@ $ bundle install
35
34
 
36
35
  ## Support
37
36
 
38
- - Rails 5.2+
39
- - Ruby 2.5+
37
+ - Rails 7.1+
38
+ - Ruby 3.2+
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/form.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'yuba/form/coercion'
2
2
  require 'yuba/form/multi_parameter_attributes'
3
+ require 'reform/form/active_model/validations'
3
4
 
4
5
  module Yuba
5
6
  class Form < ::Reform::Form
@@ -9,6 +10,7 @@ module Yuba
9
10
  subclass.feature MultiParameterAttributes
10
11
  subclass.include Reform::Form::ActiveRecord
11
12
  subclass.include Reform::Form::ActiveModel::ModelReflections
13
+ subclass.include Reform::Form::ActiveModel::Validations
12
14
  end
13
15
  end
14
16
  end
data/lib/yuba/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yuba
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
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.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - willnet
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2021-04-26 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -16,14 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 5.2.0
18
+ version: 7.1.0
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: 5.2.0
25
+ version: 7.1.0
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: reform-rails
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -40,102 +39,18 @@ dependencies:
40
39
  version: '0'
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: dry-types
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 0.12.2
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 0.12.2
55
- - !ruby/object:Gem::Dependency
56
- name: sqlite3
57
42
  requirement: !ruby/object:Gem::Requirement
58
43
  requirements:
59
44
  - - ">="
60
45
  - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: pry-rails
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: capybara
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: puma
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: selenium-webdriver
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: webdrivers
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
46
+ version: '1.0'
47
+ type: :runtime
133
48
  prerelease: false
134
49
  version_requirements: !ruby/object:Gem::Requirement
135
50
  requirements:
136
51
  - - ">="
137
52
  - !ruby/object:Gem::Version
138
- version: '0'
53
+ version: '1.0'
139
54
  description: Add New Layers to Rails. Form, Service, ViewModel.
140
55
  email:
141
56
  - netwillnet@gmail.com
@@ -164,7 +79,6 @@ homepage: https://github.com/willnet/yuba
164
79
  licenses:
165
80
  - MIT
166
81
  metadata: {}
167
- post_install_message:
168
82
  rdoc_options: []
169
83
  require_paths:
170
84
  - lib
@@ -172,15 +86,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
86
  requirements:
173
87
  - - ">="
174
88
  - !ruby/object:Gem::Version
175
- version: '0'
89
+ version: 3.2.0
176
90
  required_rubygems_version: !ruby/object:Gem::Requirement
177
91
  requirements:
178
92
  - - ">="
179
93
  - !ruby/object:Gem::Version
180
94
  version: '0'
181
95
  requirements: []
182
- rubygems_version: 3.1.6
183
- signing_key:
96
+ rubygems_version: 3.6.7
184
97
  specification_version: 4
185
98
  summary: Add New Layers to Rails
186
99
  test_files: []