Skip to content

Instantly share code, notes, and snippets.

@paveltyk
Created November 18, 2010 18:42
Show Gist options
  • Save paveltyk/705404 to your computer and use it in GitHub Desktop.
Save paveltyk/705404 to your computer and use it in GitHub Desktop.
output_file = File.open 'activemerchant_gateway_output.rb', 'w'
output_file.puts "PAYMENT_GATEWAYS = {"
File.open 'activemerchant_gateway_input.txt' do |input_file|
input_file.each_line do |line|
match = line.match /^.*?(\w*).rb:.*class (\w*)Gateway.*$/
next unless match
output_file.puts " \"#{match[1]}\" => {"
output_file.puts " :name => \"#{match[2]}\","
output_file.puts " :class => ActiveMerchant::Billing::#{match[2]}Gateway"
output_file.puts " },"
end
end
output_file.puts "}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment