lib/reactive-router/component.rb in reactive-router-0.7.4 vs lib/reactive-router/component.rb in reactive-router-0.7.5
- old
+ new
@@ -1,40 +1,42 @@
module React
module Component
module ClassMethods
-
+
def url_param_evaluators
- @url_param_evaluators ||= {}
+ @url_param_evaluators ||= []
end
-
+
attr_accessor :evaluated_url_params
-
- def router_param(name, &block)
-
- url_param_evaluators[name] = block
-
+
+ def router_param(name, opts = {}, &block)
+
+ method_name = opts[:as] || name
+
+ url_param_evaluators << [name, block]
+
class << self
- define_method name do
+ define_method method_name do
evaluated_url_params[name]
end
end
-
- define_method name do
- self.class.send(name)
+
+ define_method method_name do
+ self.class.send(method_name)
end
-
+
end
-
+
end
def route_handler(*args)
Router::RR::RouteHandler(*args)
end
def link(opts = {}, &block)
opts[:params] = opts[:params].to_n if opts[:params]
Router::RR::Link(opts, &block)
end
-
+
end
end