<commit_before>
module SamlTool
  class Reader
    attr_reader :saml, :config, :namespaces

    def initialize(saml, config = {}, namespaces = {})
      @saml = SamlTool::SAML(saml)
      @config = Hashie::Mash.new(config)
      @namespaces = namespaces
      build_methods
    end

    def to_hash
      config.keys.inject({}){|hash, key| hash[key.to_sym] = send(key.to_sym); hash}
    end

    private
    def build_methods
      @config.each do |key, value|
        self.class.send :attr_reader, key.to_sym<commit_msg>Changes reader.namespaces default to nil, so Nokogiri ignores namespace if non-entered.<commit_after>
module SamlTool
  class Reader
    attr_reader :saml, :config, :namespaces

    def initialize(saml, config = {}, namespaces = nil)
      @saml = SamlTool::SAML(saml)
      @config = Hashie::Mash.new(config)
      @namespaces = namespaces
      build_methods
    end

    def to_hash
      config.keys.inject({}){|hash, key| hash[key.to_sym] = send(key.to_sym); hash}
    end

    private
    def build_methods
      @config.each do |key, value|
        self.class.send :attr_reader, key.to_sym
{'fraction_non_alphanumeric': 0.11280214861235452, 'fraction_numerical': 0.0, 'mean_word_length': 3.0215827338129495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3913877', 'n_tokens_mistral': 383, 'n_tokens_neox': 371, 'n_words': 88}