Module: Mosaic

Defined in:
lib/mosaic.rb,
lib/mosaic/bin.rb,
lib/mosaic/module.rb,
lib/mosaic/version.rb,
lib/mosaic/response.rb,
lib/mosaic/application.rb,
lib/mosaic/stores/yaml.rb,
lib/mosaic/modules/info.rb,
lib/mosaic/modules/static.rb

Overview

Main Mosaic Module, all code is contained within this Module

Defined Under Namespace

Modules: Modules, Stores Classes: Application, Bin, Module, Response

Constant Summary collapse

VERSION =

Mosaics Version Number

"0.0.1"

Class Method Summary collapse

Class Method Details

.add_middleware(middleware) ⇒ Object

Adds a piece middleware to the array



20
21
22
23
# File 'lib/mosaic/module.rb', line 20

def self.add_middleware(middleware)
  @middleware ||= []
  @middleware.push(middleware)
end

.add_response(type, path, mod) ⇒ Object

Adds a responder to the hash



14
15
16
17
# File 'lib/mosaic/module.rb', line 14

def self.add_response(type, path, mod)
  @responders ||= {}
  @responders[path] = [mod, type]
end

.error404Object

Return the inbuilt 404 page



3
4
5
# File 'lib/mosaic/modules/static.rb', line 3

def self.error404
  File.read(File.expand_path("../../../../support/views/errors/error404.html.erb", __FILE__))
end

.middlewareObject

An Array of middleware to be loaded by Mosaic::Application



9
10
11
# File 'lib/mosaic/module.rb', line 9

def self.middleware
  @middleware || []
end

.respondersObject

A hash of paths with response classes e.g.

"/foo" => [FooHandler, :get]


4
5
6
# File 'lib/mosaic/module.rb', line 4

def self.responders
  @responders || {}
end

.rootObject

Returns the root path, used by Moasic::Application



10
11
12
# File 'lib/mosaic.rb', line 10

def self.root
  @root
end

.set_root(path) ⇒ Object

Sets the root path, used in the users application to set the root to the applications root



5
6
7
# File 'lib/mosaic.rb', line 5

def self.set_root(path)
  @root = path
end