Skip to content
Browse files

Fixed issue with attr_alias

  • Loading branch information...
1 parent 820397b commit 116e0b9f3c98d9dad2c7ee89ce67ee68a473c354 @brymck committed
Showing with 16 additions and 14 deletions.
  1. +15 −13 lib/rupee/security.rb
  2. +1 −1 lib/rupee/version.rb
View
28 lib/rupee/security.rb
@@ -33,19 +33,21 @@ def initialize(opts = {})
end
end
- # Aliases an attribute, taking into account both its getter and setter
- # methods. For example,
- #
- # attr_accessor :price
- # attr_alias :value, :price
- #
- # would add both a <tt>value</tt> and a <tt>value=</tt> that are equivalent
- # to their <tt>price</tt> counterparts.
- def attr_alias(new_read, old_read)
- alias_method(new_read, old_read) if method_defined?(old_read)
- new_write = "#{new_read}="
- old_write = "#{old_read}="
- alias_method(new_write, old_write) if method_defined?(old_write)
+ class << self
+ # Aliases an attribute, taking into account both its getter and setter
+ # methods. For example,
+ #
+ # attr_accessor :price
+ # attr_alias :value, :price
+ #
+ # would add both a <tt>value</tt> and a <tt>value=</tt> that are equivalent
+ # to their <tt>price</tt> counterparts.
+ def attr_alias(new_read, old_read)
+ alias_method(new_read, old_read) if method_defined?(old_read)
+ new_write = "#{new_read}="
+ old_write = "#{old_read}="
+ alias_method(new_write, old_write) if method_defined?(old_write)
+ end
end
end
end
View
2 lib/rupee/version.rb
@@ -1,4 +1,4 @@
module Rupee
# The current version
- VERSION = "0.1.4"
+ VERSION = "0.1.5"
end

0 comments on commit 116e0b9

Please sign in to comment.
Something went wrong with that request. Please try again.