Sha256: 21a7d5f8b2db5a948b072d576ce6b13ce29176c8b25ce483f08eaed2eaa7979f

Contents?: true

Size: 908 Bytes

Versions: 5

Compression:

Stored size: 908 Bytes

Contents

module Spinebox
  module Config
    
    # Reset the config
    def self.reset!
      @@configuration = nil
    end
    reset!
    
    # Offer the configuration
    def self.configuration(&block)
      @@configuration ||= OpenStruct.new(
        :assets => Sprockets::Environment.new,
        :views  => Sprockets::Environment.new,
        :reload => true
      )
      
      block.call(@@configuration) if block
      @@configuration
    end
    
  end
  
  class << self
    
    # Offers the configuration with the assets
    def config
      block = Proc.new if block_given?
      Config.configuration(&block)
    end
    
    # Straight access to the assets
    def assets
      config.assets
    end
    
    # Straight access to the views
    def views
      config.views
    end
    
    # Load the config
    def load_config!(config = "./config/config.rb")
      load config
    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spinebox-0.0.15 lib/spinebox/config.rb
spinebox-0.0.14 lib/spinebox/config.rb
spinebox-0.0.13 lib/spinebox/config.rb
spinebox-0.0.12 lib/spinebox/config.rb
spinebox-0.0.11 lib/spinebox/config.rb