Sha256: b8a286799956dffa18419eaeec9f48507ec4a5c52901b6f9442a24586cb3bc7a
Contents?: true
Size: 791 Bytes
Versions: 1
Compression:
Stored size: 791 Bytes
Contents
module Roles::Generic::Role module InstanceMethods def role_class self.class.role_class_name end def get_roles _roles raise "Role class #{role_class} does not have a #find_role(role) method" if !role_class.respond_to? :find_role _roles = _roles.flatten.compact _roles = _roles.select{|role| role.kind_of?(role_class) || role.kind_of_label?} _roles.map! do |role| case role when role_class role.name else role.to_s end end end end module ClassMethods def role_class_name @role_class_name end def role_class class_constant const = class_constant.to_s.camelize @role_class_name = "#{const}".constantize end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
roles_generic-0.2.7 | lib/roles_generic/generic/role.rb |