roles_generic 0.3.4 → 0.3.5

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.3.5
@@ -34,7 +34,7 @@ module Roles
34
34
  attr_accessor :name
35
35
 
36
36
  def initialize strategy_name
37
- @name = strategy_name.to_s.underscore.to_sym
37
+ @name = strategy_name.to_s.underscore.to_sym
38
38
  end
39
39
 
40
40
  def type
@@ -13,6 +13,12 @@ module Roles::Generic
13
13
  attr_accessor(*::Roles::Generic::User::INHERITABLE_CLASS_ATTRIBUTES)
14
14
 
15
15
  def apply_options options = {}
16
+ if options.kind_of?(Hash) && options[:attribute]
17
+ roles_attribute options[:attribute]
18
+ return
19
+ end
20
+
21
+ puts "default: #{default_options? options}, att: #{default_role_attribute}"
16
22
  roles_attribute default_role_attribute if default_options? options
17
23
  end
18
24
 
@@ -21,7 +27,7 @@ module Roles::Generic
21
27
  def default_options? options
22
28
  return true if options == :default
23
29
  if options.kind_of? Hash
24
- return true if options[:config] == :default || options == {}
30
+ return true # if options[:config] == :default || options == {}
25
31
  end
26
32
  false
27
33
  end
@@ -50,7 +50,7 @@ module Roles
50
50
  def default_options? options = {}
51
51
  return true if options == :default
52
52
  if options.kind_of? Hash
53
- return true if options[:config] == :default || options == {}
53
+ return true # if options[:config] == :default || options == {}
54
54
  end
55
55
  false
56
56
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{roles_generic}
8
- s.version = "0.3.4"
8
+ s.version = "0.3.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kristian Mandrup"]
@@ -4,7 +4,7 @@ class User
4
4
 
5
5
  attr_accessor :name
6
6
 
7
- strategy :admin_flag
7
+ strategy :admin_flag, :role_class => :role
8
8
  valid_roles_are :admin, :user, :guest
9
9
 
10
10
  def initialize name, *new_roles
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 4
9
- version: 0.3.4
8
+ - 5
9
+ version: 0.3.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kristian Mandrup