-
-
Save jbarnette/499278 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
################################################################################ | |
### M E T H O D N A M E :: address ############################################ | |
### A R G U M E N T S :: separator[String] ################################## | |
### R E T U R N S :: String ############################################# | |
### A U T H O R :: Alan Smithee ####################################### | |
### D A T E :: 1989-10-31 ######################################### | |
################################################################################ | |
def address separator | |
# THIS IS OUR ADDRESS TEMPLATE | |
%q( | |
Billing Address 1 | |
Billing Address 2 | |
Billing City | |
Billing State Billing Zip | |
Billing Phone | |
). | |
# AND NOW WE GENERATE THE ADDRESS | |
gsub(/(Billing\s+\w+)(\s+(\d+))?/) { | |
$1.downcase.tr(" ", "_") + ($3 || "") }.strip. | |
gsub(/^\s+/) { "" }.gsub(/(\w+)/) { send $1 }.gsub(/\n$/, separator) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment