Permalink
Browse files

Add Array#to_strings which to_s's all elements in an array.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3114 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent baa2ab5 commit 5d785dbc1142aab3b6bb1bc1d0e4d611c7fe45c5 Marcel Molina committed Nov 20, 2005
View
@@ -1,5 +1,7 @@
*SVN*
+* Add Array#to_strings which to_s's all elements in an array. [Marcel Molina Jr., Sam Stephenson]
+
* Added the following methods [Marcel Molina Jr., Sam Stephenson]:
* Object#copy_instance_variables_from(object) to copy instance variables from one object to another
* Object#extended_by to get an instance's included/extended modules
@@ -24,6 +24,10 @@ def to_sentence(options = {})
def to_param
join '/'
end
+
+ def to_strings
+ map { |element| element.to_s }
+ end
end
end
end
@@ -33,4 +33,8 @@ def test_two_elements
def test_one_element
assert_equal "one", ['one'].to_sentence
end
+
+ def test_to_strings
+ assert_equal %w(one two three), [:one, :two, :three].to_strings
+ end
end

0 comments on commit 5d785db

Please sign in to comment.