Emphasize a string in ruby
It ain’t pretty or fast, but it is effective. Make it better.
About this entry
You’re currently reading “Emphasize a string in ruby,” an entry on e-huned.com
- Published:
- 06.27.09 / 10am
- Category:
- personal
It ain’t pretty or fast, but it is effective. Make it better.
You’re currently reading “Emphasize a string in ruby,” an entry on e-huned.com
you should really read through your libraries:
http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M002029
Yeah, ActionView is sufficient if you want to do brainless string substitution. Mine emphasizes only on word boundary. Which you pretty much want all the time.
More clearly: it emphasizes on a regex match — word boundary being only one of the possibilities.
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">
3 Comments
Jump to comment form | comments rss [?] | trackback uri [?]