Class: Bali::Ruler
- Inherits:
-
Object
- Object
- Bali::Ruler
- Defined in:
- lib/bali/ruler.rb
Overview
This class represents all roles, and its rules, for a resource
Instance Attribute Summary collapse
-
#roles ⇒ Object
Returns the value of attribute roles.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(role) ⇒ Object
- #[](role) ⇒ Object
- #find_or_create_role(role_name) ⇒ Object
-
#initialize(model_class) ⇒ Ruler
constructor
A new instance of Ruler.
Constructor Details
Instance Attribute Details
#roles ⇒ Object
Returns the value of attribute roles.
4 5 6 |
# File 'lib/bali/ruler.rb', line 4 def roles @roles end |
Class Method Details
Instance Method Details
#<<(role) ⇒ Object
19 20 21 |
# File 'lib/bali/ruler.rb', line 19 def << role @roles[role.name] = role end |
#[](role) ⇒ Object
23 24 25 26 |
# File 'lib/bali/ruler.rb', line 23 def [] role symbolized_role = role.to_sym if role @roles[symbolized_role] end |