Module: IAmICan::Role::Helpers::Ins
- Included in:
- Assignment
- Defined in:
- lib/i_am_i_can/role/helpers.rb
Instance Method Summary collapse
- #__role ⇒ Object
- #_role_assignment_result(names, failed_items) ⇒ Object
- #local_role_names ⇒ Object
- #local_roles ⇒ Object
- #roles ⇒ Object (also: #role_names)
Instance Method Details
#__role ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/i_am_i_can/role/helpers.rb', line 52 def __role proc do |role| next role.to_sym if role.is_a?(String) || role.is_a?(Symbol) next role.name if role.is_a?(i_am_i_can.role_model) # raise error end end |
#_role_assignment_result(names, failed_items) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/i_am_i_can/role/helpers.rb', line 44 def _role_assignment_result(names, failed_items) prefix = 'Role Assignment Done' fail_msg = prefix + ", but #{failed_items} have not been defined or have been repeatedly assigned" if failed_items.present? raise Error, fail_msg if i_am_i_can.strict_mode && fail_msg puts fail_msg || prefix unless ENV['ITEST'] prefix.present? end |
#local_role_names ⇒ Object
60 61 62 |
# File 'lib/i_am_i_can/role/helpers.rb', line 60 def local_role_names @local_role_names ||= [ ] end |
#local_roles ⇒ Object
64 65 66 |
# File 'lib/i_am_i_can/role/helpers.rb', line 64 def local_roles defined_local_roles.slice(*local_role_names) end |
#roles ⇒ Object Also known as: role_names
68 69 70 |
# File 'lib/i_am_i_can/role/helpers.rb', line 68 def roles local_role_names + stored_role_names end |