easy_routes 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/init.rb +1 -0
- data/lib/easy_routes.rb +39 -0
- data/lib/tasks/rubyforge_config.yml +5 -0
- metadata +53 -0
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'easy_routes'
|
data/lib/easy_routes.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# module ActionController
|
2
|
+
# module Routing
|
3
|
+
# module RouteSet
|
4
|
+
# end
|
5
|
+
# end
|
6
|
+
# end
|
7
|
+
class ActionController::Routing::RouteSet::Mapper
|
8
|
+
|
9
|
+
def method_missing(route_name, *args, &proc)
|
10
|
+
#puts "route_name: #{route_name}"
|
11
|
+
#puts "args: #{args}"
|
12
|
+
if args.first.is_a? String
|
13
|
+
return h_method_missing(route_name, *args, &proc)
|
14
|
+
end
|
15
|
+
cont = args.first[:controller]
|
16
|
+
act = args.first[:action] || route_name.to_s
|
17
|
+
r_name = "#{cont}/#{act}"
|
18
|
+
r_name += "/:id" unless args.first[:id] == false
|
19
|
+
ags = []
|
20
|
+
h_method_missing("#{cont}_#{route_name}", r_name, {:controller => cont, :action => act})
|
21
|
+
end
|
22
|
+
|
23
|
+
def h_method_missing(route_name, *args, &proc)
|
24
|
+
super unless args.length >= 1 && proc.nil?
|
25
|
+
@set.add_named_route(route_name, *args)
|
26
|
+
end
|
27
|
+
|
28
|
+
def defaults(*args)
|
29
|
+
[{:action => "index", :id => false},
|
30
|
+
{:action => "list", :id => false},
|
31
|
+
{:action => "new", :id => false},
|
32
|
+
{:action => "create", :id => false},
|
33
|
+
{:action => "show"}, {:action => "edit"},
|
34
|
+
{:action => "update"}, {:action => "destroy"}].each do |ag|
|
35
|
+
ag.merge!(args.first)
|
36
|
+
eval "self.#{ag[:action]} ag"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.2
|
3
|
+
specification_version: 1
|
4
|
+
name: easy_routes
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2007-09-17 00:00:00 -04:00
|
8
|
+
summary: easy_routes
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
- lib
|
12
|
+
- lib
|
13
|
+
- lib/tasks
|
14
|
+
email:
|
15
|
+
homepage:
|
16
|
+
rubyforge_project: magrathea
|
17
|
+
description: "easy_routes was developed by: markbates"
|
18
|
+
autorequire:
|
19
|
+
- easy_routes
|
20
|
+
- easy_routes
|
21
|
+
default_executable:
|
22
|
+
bindir: bin
|
23
|
+
has_rdoc: false
|
24
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 0.0.0
|
29
|
+
version:
|
30
|
+
platform: ruby
|
31
|
+
signing_key:
|
32
|
+
cert_chain:
|
33
|
+
post_install_message:
|
34
|
+
authors:
|
35
|
+
- markbates
|
36
|
+
files:
|
37
|
+
- init.rb
|
38
|
+
- lib/easy_routes.rb
|
39
|
+
- lib/tasks/rubyforge_config.yml
|
40
|
+
test_files: []
|
41
|
+
|
42
|
+
rdoc_options: []
|
43
|
+
|
44
|
+
extra_rdoc_files: []
|
45
|
+
|
46
|
+
executables: []
|
47
|
+
|
48
|
+
extensions: []
|
49
|
+
|
50
|
+
requirements: []
|
51
|
+
|
52
|
+
dependencies: []
|
53
|
+
|