Class: Rolify::Adapter::Base
- Inherits:
-
Object
- Object
- Rolify::Adapter::Base
- Defined in:
- lib/rolify/adapters/base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #add(relation, role_name, resource = nil) ⇒ Object
- #build_conditions(relation, args) ⇒ Object
- #build_query(role, resource = nil) ⇒ Object
- #exists?(relation, column) ⇒ Boolean
- #find(relation, role_name, resource) ⇒ Object
- #find_or_create_by(role_name, resource_type = nil, resource_id = nil) ⇒ Object
- #in(resources, roles) ⇒ Object
-
#initialize(role_cname) ⇒ Base
constructor
A new instance of Base.
- #remove(relation, role_name, resource = nil) ⇒ Object
- #resources_find(roles_table, relation, role_name) ⇒ Object
- #role_class ⇒ Object
- #where(relation, args) ⇒ Object
Constructor Details
#initialize(role_cname) ⇒ Base
Returns a new instance of Base.
4 5 6 |
# File 'lib/rolify/adapters/base.rb', line 4 def initialize(role_cname) @role_cname = role_cname end |
Instance Method Details
#add(relation, role_name, resource = nil) ⇒ Object
24 25 26 |
# File 'lib/rolify/adapters/base.rb', line 24 def add(relation, role_name, resource = nil) raise NotImplementedError.new("You must implement add") end |
#build_conditions(relation, args) ⇒ Object
44 45 46 |
# File 'lib/rolify/adapters/base.rb', line 44 def build_conditions(relation, args) raise NotImplementedError.new("You must implement build_conditions") end |
#build_query(role, resource = nil) ⇒ Object
48 49 50 |
# File 'lib/rolify/adapters/base.rb', line 48 def build_query(role, resource = nil) raise NotImplementedError.new("You must implement build_query") end |
#exists?(relation, column) ⇒ Boolean
40 41 42 |
# File 'lib/rolify/adapters/base.rb', line 40 def exists?(relation, column) raise NotImplementedError.new("You must implement exists?") end |
#find(relation, role_name, resource) ⇒ Object
12 13 14 |
# File 'lib/rolify/adapters/base.rb', line 12 def find(relation, role_name, resource) raise NotImplementedError.new("You must implement find") end |
#find_or_create_by(role_name, resource_type = nil, resource_id = nil) ⇒ Object
20 21 22 |
# File 'lib/rolify/adapters/base.rb', line 20 def find_or_create_by(role_name, resource_type = nil, resource_id = nil) raise NotImplementedError.new("You must implement find_or_create_by") end |
#in(resources, roles) ⇒ Object
36 37 38 |
# File 'lib/rolify/adapters/base.rb', line 36 def in(resources, roles) raise NotImplementedError.new("You must implement in") end |
#remove(relation, role_name, resource = nil) ⇒ Object
28 29 30 |
# File 'lib/rolify/adapters/base.rb', line 28 def remove(relation, role_name, resource = nil) raise NotImplementedError.new("You must implement delete") end |
#resources_find(roles_table, relation, role_name) ⇒ Object
32 33 34 |
# File 'lib/rolify/adapters/base.rb', line 32 def resources_find(roles_table, relation, role_name) raise NotImplementedError.new("You must implement resources_find") end |
#role_class ⇒ Object
8 9 10 |
# File 'lib/rolify/adapters/base.rb', line 8 def role_class @role_cname.constantize end |
#where(relation, args) ⇒ Object
16 17 18 |
# File 'lib/rolify/adapters/base.rb', line 16 def where(relation, args) raise NotImplementedError.new("You must implement where") end |