Module: Rufus::Sixjo

Defined in:
lib/rufus/sixjo.rb

Defined Under Namespace

Modules: Erb Classes: App, Context, Route

Constant Summary collapse

VERSION =
'0.1.4'
@@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.



427
428
429
430
# File 'lib/rufus/sixjo.rb', line 427

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


418
419
420
421
# File 'lib/rufus/sixjo.rb', line 418

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



438
439
440
441
# File 'lib/rufus/sixjo.rb', line 438

def new_sixjo_rack_app (next_app, options={})

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