module Ramverk

Ramverk is a web application framework written in Ruby.

Constants

VERSION

Current version number.

Public Class Methods

boot() click to toggle source

Boot the project.

@return [true]

@raise [RuntimeError] If project already been booted.

@example

Ramverk.boot
# File lib/ramverk.rb, line 54
def self.boot
  raise "project has already been booted" if @booted

  configuration.boot
  @booted = true
end
configuration() click to toggle source

Project configuration.

@return [Ramverk::Configuration]

# File lib/ramverk.rb, line 30
def self.configuration
  @configuration
end
configure() { |configuration| ... } click to toggle source

Configure project within a block.

@yield [config] Configuration. @yieldparam config [Ramverk::Configuration]

@example

Ramverk.configure do |config|
end
# File lib/ramverk.rb, line 42
def self.configure
  yield configuration
end
env() click to toggle source

Get the current environment status.

@return [Symbol]

# File lib/ramverk.rb, line 12
def self.env
  (ENV["APP_ENV"] || ENV["RACK_ENV"] || :development).to_sym
end
env?(*environment) click to toggle source

Check if the given environment match the current.

@overload env?(environment, …)

@param environment [Symbol]
@param ... [Symbol]

@return [Boolean]

# File lib/ramverk.rb, line 23
def self.env?(*environment)
  environment.include?(env)
end
rack() click to toggle source

Rack compatible endpoint.

@return [#call]

# File lib/ramverk.rb, line 64
def self.rack
  boot unless @booted

  builder = Rack::Builder.new

  configuration.middleware.stack.each do |(mw, args, block)|
    builder.use mw, *args, &block
  end

  builder.run Resolver.new(configuration.apps).freeze
  builder.freeze
end
rake?() click to toggle source

Check if the program is running via Rake.

@return [Boolean]

# File lib/ramverk.rb, line 80
def self.rake?
  File.basename($PROGRAM_NAME) == "rake"
end
reset!() click to toggle source

@private

# File lib/ramverk.rb, line 85
def self.reset!
  @booted = false
  @configuration = Configuration.new
end