Class: Roles::Base::RoleStrategyId
- Inherits:
-
Object
- Object
- Roles::Base::RoleStrategyId
- Defined in:
- lib/roles_generic/base.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(strategy_name) ⇒ RoleStrategyId
constructor
A new instance of RoleStrategyId.
- #multiplicity ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(strategy_name) ⇒ RoleStrategyId
Returns a new instance of RoleStrategyId.
37 38 39 |
# File 'lib/roles_generic/base.rb', line 37 def initialize strategy_name @name = strategy_name.to_s.underscore.to_sym end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
35 36 37 |
# File 'lib/roles_generic/base.rb', line 35 def name @name end |
Instance Method Details
#multiplicity ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/roles_generic/base.rb', line 50 def multiplicity @multiplicity ||= case name when :many_roles, :role_strings, :roles_mask, :roles_string, :embed_many_roles :multi when :one_role, :admin_flag, :role_string, :embed_one_role :single end end |
#type ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/roles_generic/base.rb', line 41 def type @type ||= case name when :one_role, :many_roles, :embed_one_role, :embed_many_roles :complex else return :simple if name end end |