names.select { |name| name.start_with?("S") }.
map { |name| name.upcase }.
sort.
join(', ')
Which is slightly more annoying in that you need to modify two lines to add a new chained line (the line you are adding and the dot added to the previous line).This also creates a mild headache when refactoring, as any change to the length of the "names" variable would force you to re-align the entire chain. You could do something like:
names.
select { |name| name.start_with?("S") }.
map { |name| name.upcase }.
sort.
join(', ')