Sha256: c13491ec7349669117b380c229d47fb695ede22c1e831d3985c34c6b757485af

Contents?: true

Size: 1.13 KB

Versions: 8

Compression:

Stored size: 1.13 KB

Contents

module Pancake
  class Stack

    class Configuration < Pancake::Configuration::Base
    end

    # Provides access to the configuration block for the stack.
    # If a block is provided, it opens the specific configuration instances anonymous class
    # and allows you to edit it.
    # If no block is provided, it just returns the configuration object.
    #
    # :api: public
    def self.configuration(label = self, &block)
      config = Pancake.configuration.configs[label] ||= self::Configuration.new
      config.class.class_eval(&block) if block
      config
    end

    def configuration(label = self.class)
      yield self.class.configuration(label) if block_given?
      self.class.configuration(label)
    end

  end # Stack
end # Pancake

####################
# Setup the default configuration for each stack
class Pancake::Stack::Configuration
  default :router, lambda{ _router }, "The router for this stack"
  
  def _router
    @_router ||= begin
      unless stack.nil?
        r = stack.router.dup
        r.configuration = self
        r.app = app
        r.configuration = self
        r
      end
                   
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
hassox-pancake-0.1.6 lib/pancake/stack/configuration.rb
pancake-0.1.17 lib/pancake/stack/configuration.rb
pancake-0.1.16 lib/pancake/stack/configuration.rb
pancake-0.1.15 lib/pancake/stack/configuration.rb
pancake-0.1.13 lib/pancake/stack/configuration.rb
pancake-0.1.12 lib/pancake/stack/configuration.rb
pancake-0.1.10 lib/pancake/stack/configuration.rb
pancake-0.1.8 lib/pancake/stack/configuration.rb