Skip to content

Instantly share code, notes, and snippets.

@nashby
Created March 21, 2012 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nashby/2151258 to your computer and use it in GitHub Desktop.
Save nashby/2151258 to your computer and use it in GitHub Desktop.
attribute_names.map do |attribute_name|
attribute(attribute_name)
end.join.html_safe
# vs.
"".html_safe.tap do |attributes|
attribute_names.each do |attribute_name|
attributes.safe_concat attribute(attribute_name)
end
end
# vs
@template.safe_join(attribute_names.map do |attribute_name|
attribute(attribute_name)
end)
# vs
attribute_names.map do |attribute_name|
attribute(attribute_name)
end.inject(:safe_concat)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment