Sha256: 3f91734a31ce76e856e862f3a969a776b9e2f2e11c18d66722e12df43c5ca73c
Contents?: true
Size: 734 Bytes
Versions: 9
Compression:
Stored size: 734 Bytes
Contents
module Cream::View module Role def self.roles_available begin return Cream::Role.available if defined? Cream::Role rescue end [:guest, :admin] end # admin?, guest? ... Cream::View::Role.roles_available.each do |role| class_eval %{ def #{role}_area &block area_for_role(:#{role}, &block) end def for_#{role}(&block) for_role(:#{role}, &block) end } end end end module Cream::Helper module Role # admin?, guest? ... Cream::View::Role.roles_available.each do |role| class_eval %{ def #{role}? has_role? :#{role} end } end end end
Version data entries
9 entries across 9 versions & 1 rubygems