Sha256: 0ce3ff4eb5e68ad2df0ef4117957e89a117927b8674f183aea55e62704f15c18

Contents?: true

Size: 661 Bytes

Versions: 14

Compression:

Stored size: 661 Bytes

Contents

module Cream::View
  module Role    
    # admin?,  guest? ...
    if defined? Cream::Role
      Cream::Role.available.each do |role|
        class_eval %{
          def #{role}_area &block
            area_for_roles(#{role}, &block)
          end 
        
          def for_#{role}(&block)
            for_roles(#{role}, &block)          
          end
        }
      end
    end
  end
end

module Cream::Helper
  module Role    
    # admin?,  guest? ...
    if defined? Cream::Role    
      Cream::Role.available.each do |role|
        class_eval %{
          def #{role}?
            has_role? :#{role}
          end
        }
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cream-0.8.6 lib/cream/configure/after_init/role_config.rb
cream-0.8.5 lib/cream/configure/after_init/role_config.rb
cream-0.8.4 lib/cream/configure/after_init/role_config.rb
cream-0.8.3 lib/cream/configure/after_init/role_config.rb
cream-0.8.2 lib/cream/configure/after_init/role_config.rb
cream-0.8.1 lib/cream/configure/after_init/role_config.rb
cream-0.8.0 lib/cream/configure/after_init/role_config.rb
cream-0.7.10 lib/cream/configure/after_init/role_config.rb
cream-0.7.8 lib/cream/configure/after_init/role_config.rb
cream-0.7.7 lib/cream/configure/after_init/role_config.rb
cream-0.7.6 lib/cream/configure/after_init/role_config.rb
cream-0.7.5 lib/cream/configure/after_init/role_config.rb
cream-0.7.3 lib/cream/configure/after_init/role_config.rb
cream-0.7.2 lib/cream/configure/after_init/role_config.rb