Sha256: be3f28f7d455f635aad9f412ff89b99f5106b416f07a6d7adeb4bd624384aa5d

Contents?: true

Size: 790 Bytes

Versions: 1

Compression:

Stored size: 790 Bytes

Contents

module CanTango
  module PermissionEngine
    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

1 entries across 1 versions & 1 rubygems

Version Path
cantango-0.8.0 lib/cantango/permission_engine/loader/base.rb