Sha256: 5bc3134192dada76207603a600e1beac650224405c4798021ab8f34d92094b31

Contents?: true

Size: 980 Bytes

Versions: 1

Compression:

Stored size: 980 Bytes

Contents

module Perennial
  class Manifest
    
    class_inheritable_accessor :app_name, :namespace
    self.app_name  = :perennial
    self.namespace =  Perennial
    
    def self.inspect
      "#<#{self.name} app_name: #{self.app_name.inspect}, namespace: #{self.namespace.inspect}>"
    end
    
    module Mixin
      # Called in your application to set the default
      # namespace and app_name. Also, if a block is
      # provided it yields first with Manifest and then
      # with the Loader class, making it simpler to setup.
      def manifest(&blk)
        Manifest.namespace = self
        Manifest.app_name  = self.name.to_s.underscore
        parent_folder = __DIR__(1)
        attempt_require parent_folder / 'core_ext', parent_folder / 'exceptions'
        unless blk.nil?
          args = []
          args << Manifest if blk.arity != 0
          args << Loader   if blk.arity > 1 || blk.arity < 0
          blk.call(*args)
        end
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Sutto-perennial-0.1.0 lib/perennial/manifest.rb