Module: Rufus::Sixjo

Defined in:
lib/rufus/sixjo.rb

Defined Under Namespace

Modules: Erb Classes: App, Context, Route

Constant Summary collapse

VERSION =
'0.1.5'
@@view_path =

View path (defaults to views, in the current working directory)

'./views'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.view_pathObject

Return the path to the views folder



75
76
77
# File 'lib/rufus/sixjo.rb', line 75

def view_path
  @@view_path
end

.view_path=(path) ⇒ Object

Set the base path to the views folder



80
81
82
# File 'lib/rufus/sixjo.rb', line 80

def view_path=( path )
  @@view_path = path
end

Instance Method Details

#configure(*envs, &block) ⇒ Object

Code in the ‘configure’ block will be run inside the application instance.



431
432
433
434
# File 'lib/rufus/sixjo.rb', line 431

def configure (*envs, &block)

  (@configures ||= []) << [ envs.collect { |e| e.to_s }, block ]
end

#helpers(&block) ⇒ Object

for example :

helpers do
  def hello
    "hello #{params['who']}"
  end
end


422
423
424
425
# File 'lib/rufus/sixjo.rb', line 422

def helpers (&block)

  (@helpers ||= []) << block
end

#new_sixjo_rack_app(next_app, options = {}) ⇒ Object

Packages the routing info into a Rack application, suitable for insertion into a Rack app chain.

Returns an instance of Rufus::Sixjo::App



442
443
444
445
# File 'lib/rufus/sixjo.rb', line 442

def new_sixjo_rack_app (next_app, options={})

  App.new(next_app, @routes, @helpers, @configures, options)
end