Sha256: 834c33023495433b91fe55af8716a321de35ac6255cbd2a622a63a2841d52074

Contents?: true

Size: 670 Bytes

Versions: 1

Compression:

Stored size: 670 Bytes

Contents

module CanTango
  class Configuration 
    class Permits < PermitRegistry
      include Singleton

      attr_reader :accounts
      # CanTango.config.permits.accounts[:admin].role => {}

      def accounts
        @accounts ||= Hash.new
      end

      def account_hash name
        accounts[name]
      end

      def method_missing method_name, *args
        accounts[method_name] ||= PermitRegistry.new
      end

      def register_permit_class(permit_name, permit_clazz, permit_type, account_name)
        registry = account_name ? self.send(account_name.to_sym) : self
        registry.send(permit_type)[permit_name] = permit_clazz
      end
    end
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cantango-0.8.5.1 lib/cantango/configuration/permits.rb