Class: Usher::Interface::Merb

Inherits:
Object
  • Object
show all
Defined in:
lib/usher/interface/merb.rb

Constant Summary collapse

UsherRoutes =
Usher.new

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.root_behaviorObject

Returns the value of attribute root_behavior.



13
14
15
# File 'lib/usher/interface/merb.rb', line 13

def root_behavior
  @root_behavior
end

Class Method Details

.compileObject



25
26
27
28
29
30
31
32
# File 'lib/usher/interface/merb.rb', line 25

def compile
  routes.each do |r| 
    r.segments
  end
  
  #puts r.inspect; UsherRoutes.add_route(r) }
  #routes.each {|r| }
end

.named_routesObject



34
35
36
# File 'lib/usher/interface/merb.rb', line 34

def named_routes
  UsherRoutes.named_routes
end

.prepare(first = [], last = [], &block) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/usher/interface/merb.rb', line 17

def prepare(first = [], last = [], &block)
  @routes = []
  root_behavior._with_proxy(&block)
  @routes = first + @routes + last
  compile
  self
end

.route_for(request) ⇒ Object



42
43
44
45
46
# File 'lib/usher/interface/merb.rb', line 42

def route_for(request)
  p request
  p UsherRoutes.tree
  UsherRoutes.recognize(request)
end

.routesObject



38
39
40
# File 'lib/usher/interface/merb.rb', line 38

def routes
  UsherRoutes.routes
end

Instance Method Details

#load_into_merb!Object

class BootLoader < ::Merb::BootLoader end



53
54
55
56
57
# File 'lib/usher/interface/merb.rb', line 53

def load_into_merb!
  ::Merb.send(:remove_const, "Router")
  ::Merb.const_set("Router", Usher::Interface::MerbInterface)
  #::Merb::BootLoader.const_set("Router", Usher::Interface::Merb::BootLoader)
end