Changeset 4455
- Timestamp:
- 06/17/06 03:01:57 (2 years ago)
- Files:
-
- trunk/activesupport/CHANGELOG (modified) (1 diff)
- trunk/activesupport/lib/active_support/core_ext/symbol.rb (modified) (1 diff)
- trunk/activesupport/test/core_ext/symbol_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/CHANGELOG
r4453 r4455 1 1 *SVN* 2 3 * Enhance Symbol#to_proc so it works with list objects, such as multi-dimensional arrays. Closes #5295 [nov@yo.rim.or.jp]. Example: 4 5 {1 => "one", 2 => "two", 3 => "three"}.sort_by(&:first).map(&:last) 6 #=> ["one", "two", "three"] 2 7 3 8 * Added Hash.create_from_xml(string) which will create a hash from a XML string and even typecast if possible [DHH]. Example: trunk/activesupport/lib/active_support/core_ext/symbol.rb
r4139 r4455 8 8 # people.select(&:manager?).collect(&:salary) 9 9 def to_proc 10 Proc.new { | obj, *args| obj.send(self, *args) }10 Proc.new { |*args| args.shift.__send__(self, *args) } 11 11 end 12 12 end trunk/activesupport/test/core_ext/symbol_test.rb
r4158 r4455 5 5 def test_to_proc 6 6 assert_equal %w(one two three), [:one, :two, :three].map(&:to_s) 7 assert_equal(%w(one two three), 8 {1 => "one", 2 => "two", 3 => "three"}.sort_by(&:first).map(&:last)) 7 9 end 8 10 end