alias_helper 0.1.1 → 0.1.2
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/README.rdoc +2 -2
- data/alias_helper.gemspec +2 -2
- data/lib/alias_helper.rb +14 -7
- data/lib/alias_helper/version.rb +1 -1
- metadata +6 -6
data/README.rdoc
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
= AliasHelper
|
2
2
|
|
3
3
|
For some reason Rails does not appear to easily expose the aliases returned by
|
4
|
-
ActiveSupport
|
5
|
-
|
4
|
+
ActiveSupport's alias_method_chain. This adds methods for retrieving the
|
5
|
+
aliases that are generated.
|
6
6
|
|
7
7
|
Author:: Clyde Law (mailto:clyde@futureadvisor.com)
|
8
8
|
License:: Released under the MIT license
|
data/alias_helper.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ["Clyde Law"]
|
10
10
|
s.email = ["clyde@futureadvisor.com"]
|
11
11
|
s.homepage = %q{http://github.com/FutureAdvisor/alias_helper}
|
12
|
-
s.summary = %q{Adds methods for retrieving the aliases that are generated by ActiveSupport
|
13
|
-
s.description = %q{For some reason Rails does not appear to easily expose the aliases returned by ActiveSupport
|
12
|
+
s.summary = %q{Adds methods for retrieving the aliases that are generated by ActiveSupport's alias_method_chain.}
|
13
|
+
s.description = %q{For some reason Rails does not appear to easily expose the aliases returned by ActiveSupport's alias_method_chain. This adds methods for retrieving the aliases that are generated.}
|
14
14
|
s.license = 'MIT'
|
15
15
|
|
16
16
|
s.add_dependency('activesupport', '>= 2.1.0')
|
data/lib/alias_helper.rb
CHANGED
@@ -1,8 +1,15 @@
|
|
1
|
-
|
1
|
+
# alias_method_chain was moved to Module in Rails 3.
|
2
|
+
module_to_patch = if defined?(ActiveSupport::CoreExtensions)
|
3
|
+
ActiveSupport::CoreExtensions::Module
|
4
|
+
else
|
5
|
+
Module
|
6
|
+
end
|
7
|
+
|
8
|
+
module_to_patch.class_eval do
|
2
9
|
|
3
10
|
# Given a target method and the feature name, returns the names of aliases
|
4
|
-
# that ActiveSupport
|
5
|
-
#
|
11
|
+
# that ActiveSupport's alias_method_chain typically defines for the target
|
12
|
+
# method and feature.
|
6
13
|
def method_chain_aliases(target, feature)
|
7
14
|
# Strip out punctuation on predicates or bang methods since
|
8
15
|
# e.g. target?_without_feature is not a valid method name.
|
@@ -14,15 +21,15 @@ module ActiveSupport::CoreExtensions::Module
|
|
14
21
|
end
|
15
22
|
|
16
23
|
# Given a target method and the feature name, returns the name of the alias
|
17
|
-
# that ActiveSupport
|
18
|
-
#
|
24
|
+
# that ActiveSupport's alias_method_chain typically defines for the target
|
25
|
+
# method with the feature.
|
19
26
|
def method_alias_with_feature(target, feature)
|
20
27
|
method_chain_aliases(target, feature)[0]
|
21
28
|
end
|
22
29
|
|
23
30
|
# Given a target method and the feature name, returns the name of the alias
|
24
|
-
# that ActiveSupport
|
25
|
-
#
|
31
|
+
# that ActiveSupport's alias_method_chain typically defines for the target
|
32
|
+
# method without the feature.
|
26
33
|
def method_alias_without_feature(target, feature)
|
27
34
|
method_chain_aliases(target, feature)[1]
|
28
35
|
end
|
data/lib/alias_helper/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alias_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Clyde Law
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-20 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activesupport
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: 2.1.0
|
34
34
|
type: :runtime
|
35
35
|
version_requirements: *id001
|
36
|
-
description: For some reason Rails does not appear to easily expose the aliases returned by ActiveSupport
|
36
|
+
description: For some reason Rails does not appear to easily expose the aliases returned by ActiveSupport's alias_method_chain. This adds methods for retrieving the aliases that are generated.
|
37
37
|
email:
|
38
38
|
- clyde@futureadvisor.com
|
39
39
|
executables: []
|
@@ -82,6 +82,6 @@ rubyforge_project: alias_helper
|
|
82
82
|
rubygems_version: 1.7.2
|
83
83
|
signing_key:
|
84
84
|
specification_version: 3
|
85
|
-
summary: Adds methods for retrieving the aliases that are generated by ActiveSupport
|
85
|
+
summary: Adds methods for retrieving the aliases that are generated by ActiveSupport's alias_method_chain.
|
86
86
|
test_files: []
|
87
87
|
|