Module: Impression

Defined in:
lib/impression.rb,
lib/impression/app.rb,
lib/impression/errors.rb,
lib/impression/version.rb,
lib/impression/rack_app.rb,
lib/impression/resource.rb,
lib/impression/file_tree.rb,
lib/impression/file_watcher.rb,
lib/impression/request_extensions/routing.rb,
lib/impression/request_extensions/responses.rb

Overview

The Impression module contains convenience methods for creating resources.

Defined Under Namespace

Modules: RequestExtensions Classes: App, BaseError, FileTree, FileWatcher, NotFoundError, RackApp, Resource

Constant Summary collapse

VERSION =
'0.13'

Class Method Summary collapse

Class Method Details

.app(path: '/', **props, &block) ⇒ Impression::App

Creates a new ‘Impression::App` instance with the given parameters.

Parameters:

  • path (String) (defaults to: '/')

    resource path (defaults to ‘“/”`)

  • **props (Hash)

    other resource properties

  • &block (Proc)

    optional block for overriding default request handler

Returns:



41
42
43
# File 'lib/impression.rb', line 41

def self.app(path: '/', **props, &block)
  App.new(path: path, **props, &block)
end

.file_tree(path: '/', **props, &block) ⇒ Impression::FileTree

Creates a new ‘Impression::FileTree` instance with the given parameters.

Parameters:

  • path (String) (defaults to: '/')

    resource path (defaults to ‘“/”`)

  • **props (Hash)

    other resource properties

  • &block (Proc)

    optional block for overriding default request handler

Returns:



31
32
33
# File 'lib/impression.rb', line 31

def self.file_tree(path: '/', **props, &block)
  FileTree.new(path: path, **props, &block)
end

.rack_app(path: '/', **props, &block) ⇒ Impression::RackApp

Creates a new ‘Impression::RackApp` instance with the given parameters.

Parameters:

  • path (String) (defaults to: '/')

    resource path (defaults to ‘“/”`)

  • **props (Hash)

    other resource properties

  • &block (Proc)

    Rack app proc (can also be passed using the ‘app:` parameter)

Returns:



51
52
53
# File 'lib/impression.rb', line 51

def self.rack_app(path: '/', **props, &block)
  RackApp.new(path: path, **props, &block)
end

.resource(path: '/', **props, &block) ⇒ Impression::Resource

Creates a new ‘Impression::Resource` instance with the given parameters and block.

Parameters:

  • path (String) (defaults to: '/')

    resource path (defaults to ‘“/”`)

  • **props (Hash)

    other resource properties

  • &block (Proc)

    optional block for overriding default request handler

Returns:



21
22
23
# File 'lib/impression.rb', line 21

def self.resource(path: '/', **props, &block)
  Resource.new(path: path, **props, &block)
end