alias_helper 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
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::CoreExtensions::Module#alias_method_chain. This adds methods
5
- for retrieving the aliases that are generated.
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::CoreExtensions::Module#alias_method_chain.}
13
- s.description = %q{For some reason Rails does not appear to easily expose the aliases returned by ActiveSupport::CoreExtensions::Module#alias_method_chain. This adds methods for retrieving the aliases that are generated.}
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
- module ActiveSupport::CoreExtensions::Module
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::CoreExtensions::Module#alias_method_chain typically
5
- # defines for the target method and feature.
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::CoreExtensions::Module#alias_method_chain typically
18
- # defines for the target method with the feature.
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::CoreExtensions::Module#alias_method_chain typically
25
- # defines for the target method without the feature.
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
@@ -1,3 +1,3 @@
1
1
  module AliasHelper
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.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-19 00:00:00 Z
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::CoreExtensions::Module#alias_method_chain. This adds methods for retrieving the aliases that are generated.
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::CoreExtensions::Module#alias_method_chain.
85
+ summary: Adds methods for retrieving the aliases that are generated by ActiveSupport's alias_method_chain.
86
86
  test_files: []
87
87