requested 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +17 -0
- data/Manifest +1 -0
- data/README.textile +1 -1
- data/Rakefile +2 -2
- data/lib/requested.rb +11 -4
- data/requested.gemspec +7 -4
- metadata +21 -8
data/LICENSE
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Author:: Maurizio Casimirri (mailto:maurizio.cas@gmail.com)
|
2
|
+
# Copyright:: Copyright (c) 2010 Maurizio Casimirri
|
3
|
+
|
4
|
+
# This library is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU Lesser General Public
|
6
|
+
# License as published by the Free Software Foundation; either
|
7
|
+
# version 2.1 of the License, or (at your option) any later version.
|
8
|
+
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
|
data/Manifest
CHANGED
data/README.textile
CHANGED
data/Rakefile
CHANGED
@@ -2,13 +2,13 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('requested', '0.
|
5
|
+
Echoe.new('requested', '0.2.0') do |p|
|
6
6
|
p.description = "ActionController::Request improvements with several methods to get info on requested actions"
|
7
7
|
p.url = "http://github.com/mcasimir/requested"
|
8
8
|
p.author = "Maurizio Casimirri"
|
9
9
|
p.email = "maurizio.cas@gmail.com"
|
10
10
|
p.ignore_pattern = ["tmp/*", "script/*"]
|
11
|
-
p.
|
11
|
+
p.runtime_dependencies = ['rails >=3.0.0']
|
12
12
|
end
|
13
13
|
|
14
14
|
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/lib/requested.rb
CHANGED
@@ -15,6 +15,8 @@
|
|
15
15
|
# License along with this library; if not, write to the Free Software
|
16
16
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
|
18
|
+
require 'requested/action'
|
19
|
+
|
18
20
|
module Requested
|
19
21
|
|
20
22
|
def self.included(base)
|
@@ -33,11 +35,11 @@ module Requested
|
|
33
35
|
end
|
34
36
|
|
35
37
|
def action()
|
36
|
-
@requested_action ||= Requested::Action.new(
|
38
|
+
@requested_action ||= Requested::Action.new(self.symbolized_path_parameters[:action])
|
37
39
|
end
|
38
40
|
|
39
41
|
def controller()
|
40
|
-
|
42
|
+
self.symbolized_path_parameters[:controller]
|
41
43
|
end
|
42
44
|
|
43
45
|
def query_params()
|
@@ -45,7 +47,7 @@ module Requested
|
|
45
47
|
end
|
46
48
|
|
47
49
|
def resource
|
48
|
-
@resource ||= controller.
|
50
|
+
@resource ||= controller.singularize.camelize.constantize rescue nil
|
49
51
|
end
|
50
52
|
|
51
53
|
def resource_name
|
@@ -56,6 +58,11 @@ module Requested
|
|
56
58
|
@collection_name ||= self.resource_name.pluralize
|
57
59
|
end
|
58
60
|
|
61
|
+
def current?(*args)
|
62
|
+
options = args.extract_options!
|
63
|
+
true if options[:controller] == self.controller && options[:action] == self.action
|
64
|
+
end
|
65
|
+
|
59
66
|
end
|
60
67
|
|
61
68
|
module ClassMethods
|
@@ -69,7 +76,7 @@ module Requested
|
|
69
76
|
end
|
70
77
|
|
71
78
|
|
72
|
-
class
|
79
|
+
class ActionDispatch::Request
|
73
80
|
include Requested
|
74
81
|
end
|
75
82
|
|
data/requested.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{requested}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.2.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Maurizio Casimirri"]
|
9
|
-
s.date = %q{2010-
|
9
|
+
s.date = %q{2010-09-05}
|
10
10
|
s.description = %q{ActionController::Request improvements with several methods to get info on requested actions}
|
11
11
|
s.email = %q{maurizio.cas@gmail.com}
|
12
|
-
s.extra_rdoc_files = ["README.textile", "lib/requested.rb", "lib/requested/action.rb"]
|
13
|
-
s.files = ["README.textile", "Rakefile", "init.rb", "lib/requested.rb", "lib/requested/action.rb", "Manifest", "requested.gemspec"]
|
12
|
+
s.extra_rdoc_files = ["LICENSE", "README.textile", "lib/requested.rb", "lib/requested/action.rb"]
|
13
|
+
s.files = ["LICENSE", "README.textile", "Rakefile", "init.rb", "lib/requested.rb", "lib/requested/action.rb", "Manifest", "requested.gemspec"]
|
14
14
|
s.homepage = %q{http://github.com/mcasimir/requested}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Requested", "--main", "README.textile"]
|
16
16
|
s.require_paths = ["lib"]
|
@@ -23,8 +23,11 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.specification_version = 3
|
24
24
|
|
25
25
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
|
26
27
|
else
|
28
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
27
29
|
end
|
28
30
|
else
|
31
|
+
s.add_dependency(%q<rails>, [">= 3.0.0"])
|
29
32
|
end
|
30
33
|
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: requested
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 31
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
|
-
- 1
|
9
7
|
- 2
|
10
|
-
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Maurizio Casimirri
|
@@ -15,10 +14,24 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-09-05 00:00:00 +02:00
|
19
18
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rails
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 3
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
version: 3.0.0
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
22
35
|
description: ActionController::Request improvements with several methods to get info on requested actions
|
23
36
|
email: maurizio.cas@gmail.com
|
24
37
|
executables: []
|
@@ -26,10 +39,12 @@ executables: []
|
|
26
39
|
extensions: []
|
27
40
|
|
28
41
|
extra_rdoc_files:
|
42
|
+
- LICENSE
|
29
43
|
- README.textile
|
30
44
|
- lib/requested.rb
|
31
45
|
- lib/requested/action.rb
|
32
46
|
files:
|
47
|
+
- LICENSE
|
33
48
|
- README.textile
|
34
49
|
- Rakefile
|
35
50
|
- init.rb
|
@@ -56,7 +71,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
56
71
|
requirements:
|
57
72
|
- - ">="
|
58
73
|
- !ruby/object:Gem::Version
|
59
|
-
hash: 3
|
60
74
|
segments:
|
61
75
|
- 0
|
62
76
|
version: "0"
|
@@ -65,7 +79,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
79
|
requirements:
|
66
80
|
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
hash: 11
|
69
82
|
segments:
|
70
83
|
- 1
|
71
84
|
- 2
|