Sha256: 445c3db918574e0013b7a67becc0984ccbc4ceb3a9c80636c39b38e06e47664b

Contents?: true

Size: 1.36 KB

Versions: 16

Compression:

Stored size: 1.36 KB

Contents

require 'merb-core'
require 'merb-core/dispatch/router/behavior'

class Usher
  module Interface
    class Merb
      
      # merb does everything with class methods.

      @root_behavior   = ::Merb::Router::Behavior.new.defaults(:action => "index")

      class << self
        attr_accessor :root_behavior
        
        UsherRoutes = Usher.new
        
        def prepare(first = [], last = [], &block)
          @routes = []
          root_behavior._with_proxy(&block)
          @routes = first + @routes + last
          compile
          self
        end
        
        def compile
          routes.each do |r| 
            r.segments
          end
          
          #puts r.inspect; UsherRoutes.add_route(r) }
          #routes.each {|r| }
        end
        
        def named_routes
          UsherRoutes.named_routes
        end
        
        def routes
          UsherRoutes.routes
        end

        def route_for(request)
          p request
          p UsherRoutes.tree
          UsherRoutes.recognize(request)
        end
        
      end
      
      #class BootLoader < ::Merb::BootLoader
      #end

      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
      
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
usher-0.7.4 lib/usher/interface/merb.rb
usher-0.7.3 lib/usher/interface/merb.rb
usher-0.7.2 lib/usher/interface/merb.rb
usher-0.7.1 lib/usher/interface/merb.rb
usher-0.7.0 lib/usher/interface/merb.rb
usher-0.6.8 lib/usher/interface/merb.rb
usher-0.6.7 lib/usher/interface/merb.rb
usher-0.6.6 lib/usher/interface/merb.rb
usher-0.6.5 lib/usher/interface/merb.rb
usher-0.6.4 lib/usher/interface/merb.rb
usher-0.6.3 lib/usher/interface/merb.rb
usher-0.6.2 lib/usher/interface/merb.rb
usher-0.6.1 lib/usher/interface/merb.rb
usher-0.6.0 lib/usher/interface/merb.rb
usher-0.5.13 lib/usher/interface/merb.rb
usher-0.5.12 lib/usher/interface/merb.rb