1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Ruby 1.9 compat: Update idiosyncratic block variable usage. Closes #10546.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8435 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2007-12-19 01:18:45 +00:00
parent a5ca52f4a5
commit 11a75f9a38
2 changed files with 7 additions and 5 deletions

View file

@ -1,6 +1,6 @@
*SVN*
* Ruby 1.9 compatibility. #1689 [Cheah Chu Yeow]
* Ruby 1.9 compatibility. #1689, #10546 [Cheah Chu Yeow, frederico]
*2.0.2* (December 16th, 2007)

View file

@ -3,14 +3,16 @@ module Rails
mattr_accessor :properties
class << (@@properties = [])
def names
map {|(name, )| name}
map { |name, value| name }
end
def value_for(property_name)
find {|(name, )| name == property_name}.last rescue nil
if property = find { |name, value| name == property_name }
property.last
end
end
end
class << self #:nodoc:
def property(name, value = nil)
value ||= yield