creed 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -6
- data/lib/creed/railtie.rb +1 -1
- data/lib/creed/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: 71ec85575cece4defb4fb57ca8521494d4c350aef99730269747872e17aa66c1
|
4
|
+
data.tar.gz: 8c15a9cfd8f219140efec5a0d0b82ca6d92dd89020898f065f29ef1ed9ce7365
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '085d2028e4f104d642cda0490d94b6d91d100bd02f1f179fb9124592529a426c593b200d144c945bea4bb7c109b2650e6e822f486bbb5f75d9c78af37472876b'
|
7
|
+
data.tar.gz: bd7c1d695f8f63cd5db1b1e7e586bdc35f56a9fa6983448ab8b67669e8ae33b1201fa1ac4a778fc1843ffc201c065c76b99488980ca5ab91a9bc29722ebeb221
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
# Creed
|
1
|
+
# Creed - Stupid Simple Commands for Rails
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Creed provides a stupid simple way to introduce the [Command Pattern](https://en.wikipedia.org/wiki/Command_pattern) to your Rails app.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,7 +20,28 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
Create your Command classes in `app/commands`, extending `Creed::Command`, and implementing a `perform` method:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
class CreateUser < Creed::Command
|
27
|
+
# Define types and/or validations.
|
28
|
+
param :user_params, Creed::Types.Instance(ActionController::Parameters)
|
29
|
+
|
30
|
+
def perform
|
31
|
+
# Do something here...
|
32
|
+
end
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
Then in your controller (or anywhere):
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
class UserController < ApplicationController
|
40
|
+
def create
|
41
|
+
CreateUser.perform(user_params)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
```
|
26
45
|
|
27
46
|
## Development
|
28
47
|
|
@@ -34,7 +53,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
34
53
|
|
35
54
|
Bug reports and pull requests are welcome on GitHub at https://github.com/joelmoss/creed. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/joelmoss/creed/blob/master/CODE_OF_CONDUCT.md).
|
36
55
|
|
37
|
-
|
38
56
|
## License
|
39
57
|
|
40
58
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/creed/railtie.rb
CHANGED
data/lib/creed/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: creed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Moss
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|