Created
July 6, 2012 02:10
-
-
Save jschairb/3057629 to your computer and use it in GitHub Desktop.
C-style interpolation in Ruby
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
TEMPLATE = "permit tcp any any eq {PORT}" | |
def generate_template(port) | |
TEMPLATE.gsub('{PORT}', port.to_s) | |
end | |
TEMPLATE = "permit tcp any any eq %{port}" | |
def generate_template(port) | |
TEMPLATE % { :port => port } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment