<commit_before>require 'yaml'

module Payzilla
  class Config
    attr_accessor :setting_url, :setting_bank, :setting_key_password,
                  :setting_partner_id, :setting_payment_poind_id,
                  :setting_host, :setting_operator, :setting_poing,
                  :setting_dealer, :setting_key, :setting_dealer_id,
                  :setting_domain, :setting_client, :setting_password,
                  :setting_agent, :setting_contract, :setting_signature_key_password,
                  :setting_terminal_prefix, :setting_terminal, :setting_wmid,
                  :setting_kiosk_id, :setting_currency, :setting_gpg_key

    attr_accessor :attachment_cert, :attachment_key, :attachment_ca,
                  :attachment_wsdl, :attachment_private_key,
                  :attachment_public_key, :attachment_signature_key,
                  :attachment_secret_key

    attr_accessor :switch_test_mode

    def initialize(config={})
      config = Yaml.load_file(config) if config.kind_of(String)

      config.each do |carier|
        carier.each{|k,v| send "#{k}=", v}
      end
    end
  end
end<commit_msg>Fixed exporting config with YAML<commit_after>require 'yaml'

module Payzilla
  class Config
    attr_accessor :setting_url, :setting_bank, :setting_key_password,
                  :setting_partner_id, :setting_payment_poind_id,
                  :setting_host, :setting_operator, :setting_poing,
                  :setting_dealer, :setting_key, :setting_dealer_id,
                  :setting_domain, :setting_client, :setting_password,
                  :setting_agent, :setting_contract, :setting_signature_key_password,
                  :setting_terminal_prefix, :setting_terminal, :setting_wmid,
                  :setting_kiosk_id, :setting_currency, :setting_gpg_key

    attr_accessor :attachment_cert, :attachment_key, :attachment_ca,
                  :attachment_wsdl, :attachment_private_key,
                  :attachment_public_key, :attachment_signature_key,
                  :attachment_secret_key

    attr_accessor :switch_test_mode

    def initialize(carrier, config={})
      config = if config.kind_of?(Hash)
                 {carrier => config}
               else
                 ::YAML.load_file(config)
               end

      begin
        config[carrier].each{|k,v| send "#{k}=", v}
      rescue NoMethodError => e
        puts "No such carrier in yaml config file"
        puts e
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08059943296881328, 'fraction_numerical': 0.0, 'mean_word_length': 2.5185185185185186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3477258', 'n_tokens_mistral': 739, 'n_tokens_neox': 700, 'n_words': 135}