class Crossroads::Router
Public Class Methods
locations()
click to toggle source
# File lib/crossroads/router.rb, line 22 def self.locations return @@locations end
matched()
click to toggle source
# File lib/crossroads/router.rb, line 26 def self.matched return @@matched end
new(attributes = {}, component: nil, render: nil, &block)
click to toggle source
# File lib/crossroads/router.rb, line 5 def initialize(attributes = {}, component: nil, render: nil, &block) @render = ->(params) { component.new(params) } if component @render = render if render @render = block if block location = attributes.delete(:location) || $$.window.location.pathname @attributes = attributes # @attributes[:key] ||= location @@locations = [ location ] @@matched = [false] end
Public Instance Methods
render()
click to toggle source
# File lib/crossroads/router.rb, line 18 def render div(@attributes, [@render.call]) end