Created
February 19, 2012 06:53
-
-
Save kubo/1862300 to your computer and use it in GitHub Desktop.
This file contains 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
module YARD | |
module Templates::Helpers | |
module HtmlHelper | |
BINARY_OPERATORS = %w{ + - * / % ** << >> & | <= < > >= <=> == === =~ }.collect { |t| CGI.escapeHTML(t) } | |
alias signature_pre_change_binary_operators signature | |
def signature(*args) | |
html = signature_pre_change_binary_operators(*args) | |
if %r{\((.+?)\) <strong>(.+?)</strong>\((.+?)\)} =~ html and BINARY_OPERATORS.include? $2 | |
"%s(%s) ← self <strong>%s</strong> %s%s" % [$`, $1, $2, $3, $'] | |
else | |
html | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment