with_role 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: def71154aaf801e2689e7d25ea762541136bfacc67cbff91814887c6586bf717
4
- data.tar.gz: b3ef28f6b5f9cd2f51b4200e9f6c8766f83dd314569e5b838a91d2f9ee52b6ee
3
+ metadata.gz: 15414f099c71dd0aa5bebf0763225dd277d1d18268d01053eca84fd9f14fa7de
4
+ data.tar.gz: d1da261599ade41fadb82ec24b351f2a6dffd792a23fe2d57b2103c9b3cd6227
5
5
  SHA512:
6
- metadata.gz: 9c85b9e61a3c75e4dd2f98d5e6e609ea4a5b3a648490f9d699b4c1759e4b5d7f0e6faf65f4f3aec1c8c84460aa50e9ab77f6e971b027f08015ce6398c0c5839b
7
- data.tar.gz: 755aa6360dd44beea517949915af9324be8d00efd1b5001dd38cebf800703909e6e822cd1e5b2dad14a576ed591380e01067dd8bce1bd8431874a3336695885d
6
+ metadata.gz: ae4454283d2c82a4828ae84519be4e31143ea592a40d4a2bd334b0ca0da60099bf0348bd1b3b2bab672de8bf45a742b4311e87a6cef161acf364656de50f2014
7
+ data.tar.gz: 244d47ab4a580fb5f208a20dddde719a516097e7d89e2200c1fb661ec29f6587a991a9d543d35581c0bfeb3ce08d52a01dd4690288c5f48a6bae802305bd19f1
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ Gemfile.lock
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # WithRole
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/with_role`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Simple role feature
6
4
 
7
5
  ## Installation
8
6
 
@@ -12,17 +10,34 @@ Add this line to your application's Gemfile:
12
10
  gem 'with_role'
13
11
  ```
14
12
 
15
- And then execute:
16
-
17
- $ bundle
13
+ ## Migration
14
+ ```ruby
15
+ create_table :users do |t|
16
+ ...
17
+ t.string :role
18
+ ...
19
+ ```
18
20
 
19
- Or install it yourself as:
21
+ ## Usage
20
22
 
21
- $ gem install with_role
23
+ ```ruby
24
+ # models/user.rb
25
+ class User < ActiveRecord::Base
26
+ with_role
27
+ end
28
+
29
+ # config/initializers/with_role.rb
30
+ # whitelist allowed roles
31
+ ::WithRole.configure do |config|
32
+ config[:available_roles] = %w(admin owner)
33
+ end
34
+
35
+ user.set_role(:admin)
36
+ user.admin_role?
37
+ => true
38
+ ```
22
39
 
23
- ## Usage
24
40
 
25
- TODO: Write usage instructions here
26
41
 
27
42
  ## Development
28
43
 
@@ -1,3 +1,3 @@
1
1
  module WithRole
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: with_role
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jude_cali