petergate 0.1.14 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f403ccb2e80f15daf60b41aeb26441cf31ee5d91
4
- data.tar.gz: a6fe058ef9628d38522725fb0eb0507f2c3b76dc
3
+ metadata.gz: 957ee14ef64ca5211f9d42069de46a3f4429cc2d
4
+ data.tar.gz: 56bfd569f9a262fa639eebe303c3fd5644f7f195
5
5
  SHA512:
6
- metadata.gz: 122e704ff116317e7fee5fbc0c3b01bda87a2cdb1eea2a935a1a46ca55c420e8ebee4001d1ea4b12993cc8bb39734106b300f323a5e1b30e29aa942d4ea43d73
7
- data.tar.gz: 431f8d73a7df7e267f3eb02c7a513ae2d36aebd926912a2f929c43348d53f7e99062a1cc04ee3cff9c9869c7f3fa76da868e803438286be3f32ac5acba185665
6
+ metadata.gz: 8d4a0d01c213460ea78e9fec901b6baeea947df053672fd251f7c5ea9ce1e4ddb471b846bbef10f42451ea759dcabc89ad56d4fe17abc94e0dadd41fbee33a1d
7
+ data.tar.gz: adf7ce67254f24cc83741eb9080a8c483f51d6fd4b2a4c13a199233059a4da01b39d673a9df8b94f17cf55cddf3bf200fb37e8081ca87c276cbf1ba83cb6e95f
data/.gitignore CHANGED
@@ -1,6 +1,6 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
3
+ Gemfile.lock
4
4
  /_yardoc/
5
5
  /coverage/
6
6
  /doc/
data/README.md CHANGED
@@ -48,8 +48,13 @@ If you need to access available roles within your project you can by calling:
48
48
 
49
49
  ```ruby
50
50
  User::ROLES
51
- # or
52
- User.available_roles
51
+ # or from an instance
52
+ User.first.available_roles
53
+ # ROLES is a CONSTANT and will still work from within the User model instance methods like in this default setter:
54
+
55
+ def roles=(v)
56
+ self[:roles] = v.map(&:to_sym).to_a.select{|r| r.size > 0 && ROLES.include?(r)}
57
+ end
53
58
  ```
54
59
 
55
60
 
data/lib/petergate.rb CHANGED
@@ -78,19 +78,13 @@ module PeterGate
78
78
  end
79
79
 
80
80
  instance_eval do
81
- @available_roles = options[:roles]
82
-
83
- def available_roles
84
- @available_roles
85
- end
86
-
87
- const_set('ROLES', available_roles)
81
+ const_set('ROLES', options[:roles])
88
82
  end
89
83
 
90
84
 
91
85
  class_eval do
92
86
  def available_roles
93
- self.class.available_roles
87
+ self.class::ROLES
94
88
  end
95
89
 
96
90
  def roles=(v)
@@ -1,3 +1,3 @@
1
1
  module Petergate
2
- VERSION = "0.1.14"
2
+ VERSION = "0.1.17"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: petergate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaac Sloan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-11 00:00:00.000000000 Z
11
+ date: 2014-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler