Sha256: 28aa09bf90a5709c1adc948c708b82257ff0a8fc03d0dfc063b0fc3b62f7dfbb
Contents?: true
Size: 930 Bytes
Versions: 15
Compression:
Stored size: 930 Bytes
Contents
module Roles::Generic::User module Configuration def configure(options={}) numericality = options[:num] type = options[:type] class_eval do include Roles::Generic::User include Roles::Generic::User::SingleRole if numericality == :single if type == :role_class include Roles::Generic::Role::InstanceMethods end include self::Implementation alias_method :role_symbols, :roles end extend Roles::Generic::User::ClassMethods extend Roles::Generic::User::DefaultRoleKeys end end module SingleRole def role roles.first end def role= new_role self.roles = new_role end end module DefaultRoleKeys def default_role_key valid_roles.last || :user end def admin_role_key valid_roles.first || :admin end end end
Version data entries
15 entries across 15 versions & 1 rubygems