Created
August 26, 2009 05:10
-
-
Save adrianpike/175336 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # delicious helper | |
| def dlify_hash(hash) | |
| '<dl>'+"\n"+hash.collect{|k,v| | |
| "\t<dd>#{k}</dd><dt>#{v}</dt>" | |
| }.join("\n")+"\n"+'</dl>' | |
| end | |
| # Or, if you're a sick bastard like me and don't care if you've got layout logic monkeypatched into Ruby Core: | |
| class Hash | |
| def to_dl | |
| '<dl>'+"\n"+self.collect{|k,v| | |
| "\t<dd>#{k}</dd><dt>#{v}</dt>" | |
| }.join("\n")+"\n"+'</dl>' | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment