Sha256: 98fbce402e7607d556a3a75fd838494b2c48a5e7e00f77149ad561a5a81459f4

Contents?: true

Size: 798 Bytes

Versions: 5

Compression:

Stored size: 798 Bytes

Contents

module CanTango
  class PermissionEngine < Engine
    module Loader
      class Base
        attr_accessor :file_name

        def self.inherited(subclass)
          subclass.extend ClassMethods
        end

        def parser
          raise NotImplementedError
        end

        def file_name= file
          raise "Couldn't find permissions file: #{file}" if file.nil? || !File.file?(file)
          @file_name = file
        end

        def yml_content
          YAML.load_file(file_name)
        end

        module ClassMethods
          protected

          def config_file name
            File.join(config_path, "#{name}.yml") if rails?
          end

          def config_path
            CanTango.config.permissions.config_path
          end
        end
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cantango-0.8.7 lib/cantango/permission_engine/loader/base.rb
cantango-0.8.6.2 lib/cantango/permission_engine/loader/base.rb
cantango-0.8.6.1 lib/cantango/permission_engine/loader/base.rb
cantango-0.8.6 lib/cantango/permission_engine/loader/base.rb
cantango-0.8.5.1 lib/cantango/permission_engine/loader/base.rb