class Shell

This is designed to be used with the corresponding bake task.

Definitions

def initialize(context)

Initialize a shell for a Bake context.

Signature

parameter context Bake::Context

The context that provides the application root.

Implementation

def initialize(context)
	@context = context
	@app = nil
end

def app

Load the configured application on first access.

Signature

returns Application

The application middleware.

Implementation

def app
	@app ||= Application.load(File.expand_path(Application::PATH, @context.root))
end

def get(path, headers = nil)

Perform a GET request.

Signature

parameter path Utopia::Path | String

The path.

parameter headers Hash

The headers.

returns Protocol::HTTP::Response

The application response.

Implementation

def get(path, headers = nil)
	app.call(Protocol::HTTP::Request["GET", path, headers])
end

def post(path, headers = nil, body = nil)

Perform a POST request.

Signature

parameter path Utopia::Path | String

The path.

parameter headers Hash

The headers.

parameter body Protocol::HTTP::Body::Readable | Nil

The request body.

returns Protocol::HTTP::Response

The application response.

Implementation

def post(path, headers = nil, body = nil)
	app.call(Protocol::HTTP::Request["POST", path, headers, body])
end

def to_s

Convert this object to a string.

Signature

returns String

The resulting string.

Implementation

def to_s
	self.class.name
end

def binding

Expose this shell's binding to IRB.

Signature

returns Binding

The shell binding.

Implementation

def binding
	super
end