Sha256: 989eb9101df6c805f26914cfe48f820f9dd96af6016fb6f9acbc98c823884b0b

Contents?: true

Size: 456 Bytes

Versions: 3

Compression:

Stored size: 456 Bytes

Contents

module CanTango
  class Ability
    module Helper
      module Role
        include CanTango::Helpers::RoleMethods

        # return list roles the user has
        def roles
          return [] if !subject.respond_to?(roles_list_meth) || roles_of(subject).blank?
          roles_of(subject).flatten
        end

        protected

        def roles_of subject
          @subj_roles ||= subject.send(roles_list_meth)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cantango-core-0.1.2 lib/cantango/ability/helper/role.rb
cantango-core-0.1.1 lib/cantango/ability/helper/role.rb
cantango-core-0.1.0 lib/cantango/ability/helper/role.rb