Sha256: c7e12cb8d09a3788b9fc2cfa3875e64c066a4f6f3758919f8134b07dbd7f1d70
Contents?: true
Size: 805 Bytes
Versions: 2
Compression:
Stored size: 805 Bytes
Contents
module IAmICan module RoleGroup module Definition def group_roles *members, by_name:, which_can: [ ], obj: nil group = (i = i_am_i_can).role_group_model.where(name: by_name).first_or_create instances, names = Role.extract(members.tap(&:flatten!), i) assignment = group._members_exec(:assign, instances, name: names) ResultOf.members assignment, i, given: [instances, names] end %i[ group_role groups_role groups_roles ].each { |aname| alias_method aname, :group_roles } def remove_roles *members, from: nil # TODO end def have_and_group_roles *members, by_name: have_roles *members group_roles *members, by_name: by_name end alias has_and_groups_roles have_and_group_roles end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
i_am_i_can-4.3.3 | lib/i_am_i_can/role_group/definition.rb |
i_am_i_can-4.3.2 | lib/i_am_i_can/role_group/definition.rb |