Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@logankoester
Created June 7, 2009 04:03
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 logankoester/125138 to your computer and use it in GitHub Desktop.
Save logankoester/125138 to your computer and use it in GitHub Desktop.
Useful for implementing the html_options hash argument on non-rails erb helpers
class Hash
def to_html_attrs
# Useful for implementing the html_options hash argument on non-rails erb helpers
attrs = Array.new
self.each_pair {|k,v| attrs.push "#{k}=\"#{v}\""}
return attrs.join " "
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment