routable 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -85,6 +85,9 @@ class AppDelegate
85
85
  @router.map("logout") do
86
86
  User.logout
87
87
  end
88
+ @router.map("logout/:id") do |params|
89
+ User.logout(params[:id])
90
+ end
88
91
 
89
92
  @window.rootViewController = @router.navigation_controller
90
93
  end
@@ -77,7 +77,14 @@ module Routable
77
77
  controller_options = options_for_url(url)
78
78
 
79
79
  if controller_options[:callback]
80
- controller_options[:callback].call
80
+ params = controller_options[:open_params]
81
+ callback = controller_options[:callback]
82
+ case callback.arity
83
+ when 0
84
+ callback.call
85
+ when 1
86
+ callback.call(params)
87
+ end
81
88
  return
82
89
  end
83
90
 
@@ -1,3 +1,3 @@
1
1
  module Routable
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -111,4 +111,14 @@ describe "the url router" do
111
111
  @router.open("logout")
112
112
  @called.should == true
113
113
  end
114
+
115
+ it "should work with callback blocks & params" do
116
+ @called = false
117
+ @router.map("logout/:id") do |params|
118
+ @called = params[:id]
119
+ end
120
+
121
+ @router.open("logout/123")
122
+ @called.should == "123"
123
+ end
114
124
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: routable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: