enum_style 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +41 -10
- data/lib/enum_style/version.rb +1 -1
- data/lib/generators/enum_style/templates/enum_style.yml +2 -2
- 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: d9b08c0964cca66d7da7798b41ba8d2286bfdb0812495d536e4e617964e8679f
|
4
|
+
data.tar.gz: a2b94d171fc7015e909e257b11161a21f14407948db4b060e5cad0fa8e25d397
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 157452700a518f671b2dd4d0af586617ef20c6fb64d7b7b6bdf0c6f0dc1bcd0c1d1ceceeb36b2a3c90601006569092fc644973b246f44e910ced20550a83b0e9
|
7
|
+
data.tar.gz: fe66e2c75b574bd4fca191563f112e4c502136f718015f1458e8253d44404c97ea165af28963342f882d6f75dc29def0fbb034eeb832741bf3dd0115391e7f43
|
data/README.md
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
-
# EnumStyle
|
2
|
-
Short description and motivation.
|
3
1
|
|
4
|
-
##
|
5
|
-
How to use my plugin.
|
2
|
+
## Installing
|
6
3
|
|
7
|
-
## Installation
|
8
4
|
Add this line to your application's Gemfile:
|
9
5
|
|
10
6
|
```ruby
|
@@ -16,13 +12,48 @@ And then execute:
|
|
16
12
|
$ bundle
|
17
13
|
```
|
18
14
|
|
19
|
-
Or install it yourself as:
|
20
|
-
```bash
|
21
|
-
$ gem install enum_style
|
22
15
|
```
|
16
|
+
rails g enum_style:install
|
17
|
+
```
|
18
|
+
|
19
|
+
```
|
20
|
+
config/enum_style.yml
|
21
|
+
```
|
22
|
+
|
23
|
+
You can now edit them to adjust to your needs.
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
In model file:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
class Article < ApplicationRecord
|
23
31
|
|
24
|
-
|
25
|
-
|
32
|
+
#----------------------------------------
|
33
|
+
# ** Enums **
|
34
|
+
#----------------------------------------
|
35
|
+
enum publish: { draft: 0, preview: 10, published: 20 }
|
36
|
+
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
You can call:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
article = Article.first
|
44
|
+
article.published!
|
45
|
+
|
46
|
+
article.publish
|
47
|
+
# -> published
|
48
|
+
|
49
|
+
article.publish_style
|
50
|
+
# -> primary
|
51
|
+
```
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
<%= tag.p(class: "btn-#{article.publish_style}") { 'content' } %>
|
55
|
+
# -> "<p class='btn-primary'>content</p>"
|
56
|
+
```
|
26
57
|
|
27
58
|
## License
|
28
59
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/enum_style/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enum_style
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kenzooooo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -17,7 +17,7 @@ dependencies:
|
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 5.2.1
|
20
|
-
type: :
|
20
|
+
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|