-
-
Save wilson/496546 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
def address(separator, seperator2=' ') | |
fields_array = %w(address1 address2 city state zip phone).map {|t| [:billing,t].join('_').to_sym} | |
(0..10).inject("") { |string, i| | |
if i.odd? | |
field = :seperator | |
field = (field.to_s + '2').intern if i == 7 | |
else | |
field = fields_array[i/2] | |
end | |
temp = send(field) rescue nil | |
unless !temp.blank? | |
temp = eval "#{field.to_s}" rescue nil | |
end | |
string += temp.blank? ? string : string + temp | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment