lightrails 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -8
  3. data/RELEASE_DATE +1 -1
  4. data/VERSION +1 -1
  5. metadata +8 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 271ee045b980f0ad9e17e55a2000013e33ee3b144422c1ebb68988ce2b40c2d1
4
- data.tar.gz: 34a232078c13956a34d673b0a54746de57d7e4aaa208c995bec51b9b8f08c66c
3
+ metadata.gz: a521e440cac4ebff625df7191cb65c497ff2867ea77ceaf89a2740efe48b6f71
4
+ data.tar.gz: e1ec1d23f661d40f30625407b53cc0c74462575617b70d97138510da246869c2
5
5
  SHA512:
6
- metadata.gz: 80085ab151534560650678157f6294d6eb0dba6b951ae3295853cdd50e7925005e268eb834a77f9d1fa3e12439b1d674b03a1bc315799e1a32b7cf5f7eb520c5
7
- data.tar.gz: 44b4c5ae9c80bcc351d875276baeff1a10cb2fc443312036b975947ee05f069b81e7c97014b7fed099514081d10bcc5c7ddfb72bd682e2a0bea2ca4c964bff8e
6
+ metadata.gz: b69819cfab918f90100d1601f5568329e13d02566d336a3423bc18d5c9e88ab27d41656b9b76d2b20e91a7ea6b3690e1af0b37346eb930372022b3bb61adecab
7
+ data.tar.gz: 3f9c82dc0abc64d9f9b04230606b1753d1eefea3c718faec64010b201f0ef855f1cfdbac576056689bb3834b6eefee827c8b4bde6acbeaa8b7c478fd96d88588
data/README.md CHANGED
@@ -24,7 +24,7 @@ $ bin/rails generate lightrails:install
24
24
 
25
25
  Add a simple interface for obtaining multiple data used in a view.
26
26
 
27
- It uses Facade design pattern and take responsibility for preparing data outside of the controller.
27
+ It uses Facade design pattern and takes responsibility for preparing data outside of the controller.
28
28
 
29
29
  In the example below, by using `MyPage::IndexFacade` and `MyPage::NotificationsFacade`, Active Record methods will be called outside of the `MyPageController`.
30
30
 
@@ -67,7 +67,7 @@ class MypageController < ApplicationController
67
67
  retrieve(facade, :active_users, :messages)
68
68
  end
69
69
 
70
- def messages
70
+ def notifications
71
71
  # You can retrieve data from the guessed facade
72
72
  # MyPageController#notifications => MyPage::NotificationsFacade
73
73
  payload = { current_user: current_user }
@@ -104,6 +104,10 @@ $ bin/rails generate facade mypage/index
104
104
 
105
105
  Add standarized data processing units to your Rails application.
106
106
 
107
+ It uses Command design pattern and will be usable for various business logic (ex: user registration) in Rails applications.
108
+
109
+ In the example, by using `RegistrationInteractor`, user registration process will be executed outside of model and controller.
110
+
107
111
  ```ruby
108
112
  class User
109
113
  attr_accessor :name
@@ -123,7 +127,6 @@ class RegistrationInteractor < ApplicationInteractor
123
127
  end
124
128
  end
125
129
 
126
- interactor = RegistrationInteractor.execute(name: "John")
127
130
  interactor.successful? # => true
128
131
  interactor.finished? # => true
129
132
  user = interactor.results[:user]
@@ -142,7 +145,7 @@ It provides a class for wrapping a object and used like Model.
142
145
  You can add custom methods to the class (using the decorator pattern).
143
146
  It can be used with API responses or simple decorators.
144
147
 
145
- In addition, `attr_field` / `attr_collection` can be used for attributes.
148
+ In addition, `attr_field` / `attr_one` / `attr_many` can be used for attributes.
146
149
 
147
150
  ### `attr_field`
148
151
 
@@ -150,10 +153,15 @@ Declare additional field and type to the objects.
150
153
  You can get / set field's value (converted to corresponding).
151
154
  It uses `ActiveModel::Attributes` internally.
152
155
 
153
- ### `attr_collection`
156
+ ### `attr_one`
157
+
158
+ Declare an associated object like has one association.
159
+ If a representer for the object is found, the object will be wrapped by the representer.
160
+
161
+ ### `attr_mamy`
154
162
 
155
- Declare sub (containing) object array like has many association.
156
- If sub object's representer is found, sub objects will be wrapped by it.
163
+ Declare associated objects like has many association.
164
+ If a representer for the objects is found, the objects will be wrapped by the representer.
157
165
 
158
166
  You can wrap hash-like objects (`OpenStruct`, `Hashie::Mash` etc.) like below.
159
167
 
@@ -167,7 +175,7 @@ end
167
175
  class UserRepresenter < ApplicationRepresenter
168
176
  attr_field :first_name, :string
169
177
  attr_field :last_name, :string
170
- attr_collection :activities
178
+ attr_many :activities
171
179
 
172
180
  def full_name
173
181
  "#{first_name} #{last_name}"
@@ -1 +1 @@
1
- 2020-03-08
1
+ 2020-03-15
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lightrails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Hashimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-08 00:00:00.000000000 Z
11
+ date: 2020-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -36,42 +36,42 @@ dependencies:
36
36
  requirements:
37
37
  - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 0.2.2
39
+ version: 0.2.3
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - '='
45
45
  - !ruby/object:Gem::Version
46
- version: 0.2.2
46
+ version: 0.2.3
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: actioninteractor
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: 0.2.2
53
+ version: 0.2.3
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - '='
59
59
  - !ruby/object:Gem::Version
60
- version: 0.2.2
60
+ version: 0.2.3
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: activerepresenter
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - '='
66
66
  - !ruby/object:Gem::Version
67
- version: 0.2.2
67
+ version: 0.2.3
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - '='
73
73
  - !ruby/object:Gem::Version
74
- version: 0.2.2
74
+ version: 0.2.3
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: bundler
77
77
  requirement: !ruby/object:Gem::Requirement