Yes, you’re calling to_s
on an array of strings. In 1.8 that is equivalent to calling join
, in 1.9 it is equivalent to calling inspect
.
To get the behavior you want in both 1.8 and 1.9, call join
instead of to_s
.
More Related Contents:
- Very Basic Ruby puts and gets
- Double vs single quotes
- Is there any difference between the `:key => “value”` and `key: “value”` hash notations?
- Why use symbols as hash keys in Ruby?
- What does %w(array) mean?
- Is Hash Rocket deprecated?
- Ruby function to remove all white spaces?
- What is the difference between Ruby 1.8 and Ruby 1.9
- Ruby: require vs require_relative – best practice to workaround running in both Ruby =1.9.2
- What’s the difference between a string and a symbol in Ruby?
- How to check whether a string contains a substring in Ruby
- Why is the shovel operator (
- What is the easiest way to remove the first character from a string?
- Backslashes in single quoted strings vs. double quoted strings
- Extract a substring from a string in Ruby using a regular expression
- Which style of Ruby string quoting do you favour?
- Set global default encoding for ruby 1.9
- String interpolation in Ruby doesn’t work?
- Measure the distance between two strings with Ruby?
- Read binary file as string in Ruby
- to_s vs. to_str (and to_i/to_a/to_h vs. to_int/to_ary/to_hash) in Ruby
- Why do two strings separated by space concatenate in Ruby?
- Convert unicode codepoint to string character in Ruby
- Ruby: Merging variables in to a string
- Split string by multiple delimiters
- What is the use case for Ruby’s %q / %Q quoting methods?
- What is the opposite of string.next?
- Test if variable matches any of several strings w/o long if-elsif chain, or case-when
- What are the benefits of the new hash syntax in Ruby 1.9?
- What is the best way to split a string to get all the substrings by Ruby?