Class: Accessly::Base
- Inherits:
-
Object
- Object
- Accessly::Base
- Defined in:
- lib/accessly/base.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(actors) ⇒ Base
constructor
Create an instance of Accessly::Base.
-
#on_segment(segment_id) ⇒ Accessly::Base
Returns the object caller.
Constructor Details
#initialize(actors) ⇒ Base
Create an instance of Accessly::Base. Lookups are cached in inherited object(s) to prevent redundant calls to the database. Pass in a Hash or ActiveRecord::Base for actors if the actor(s) inherit some permissions from other actors in the system. This may happen when you have a user in one or more groups or organizations with their own access control permissions.
16 17 18 19 20 21 22 23 24 |
# File 'lib/accessly/base.rb', line 16 def initialize(actors) @segment_id = -1 @actors = case actors when Hash actors else { actors.class.name => actors.id } end end |
Instance Method Details
#on_segment(segment_id) ⇒ Accessly::Base
Returns the object caller
28 29 30 31 |
# File 'lib/accessly/base.rb', line 28 def on_segment(segment_id) @segment_id = segment_id self end |