Sha256: 132dd1d87764f806f940f8717e161a2b49873c4ddc05bb696a0cf1982bbe009c

Contents?: true

Size: 973 Bytes

Versions: 2

Compression:

Stored size: 973 Bytes

Contents

require 'rubygems'
require 'active_support'
require 'lib/active_merchant'


class GatewaySupport
  attr_reader :gateways
  
  def initialize
    @gateways = []
    ObjectSpace.each_object(Class) do |c|  
      if c.name =~ /Gateway/ && c.ancestors.reject{|a| a == c}.include?(ActiveMerchant::Billing::Gateway)
        gateways << c
      end
    end
    
    @gateways.delete(ActiveMerchant::Billing::BogusGateway)
    @gateways = @gateways.sort_by(&:name)
  end
  
  def each_gateway
    @gateways.each{|g| yield g }
  end
  
  def to_rdoc
    each_gateway do |g|
      puts "* {#{g.display_name}}[#{g.homepage_url}] - #{g.supported_countries.join(', ')}"
    end
  end
  
  def to_textile
    each_gateway do |g|
      puts %/ * "#{g.display_name}":#{g.homepage_url} [#{g.supported_countries.join(', ')}]/
    end
  end
  
  def to_s
    each_gateway do |g|
      puts "#{g.display_name} - #{g.homepage_url} [#{g.supported_countries.join(', ')}]"
    end
  end
end


    

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activemerchant-1.2.0 lib/support/gateway_support.rb
activemerchant-1.2.1 lib/support/gateway_support.rb