<commit_before>class ApplicationLib

=begin

load adapter based on setting option

  result = self.load_adapter_by_setting( 'some_setting_with_class_name' )

returns

  result = adapter_class

=end

  def self.load_adapter_by_setting(setting)
    adapter = Setting.get( setting )
    return if !adapter

    # load backend
    self.load_adapter(adapter)
  end

=begin

load adapter

  result = self.load_adapter( 'some_class_name' )

returns

  result = adapter_class

=end

  def self.load_adapter(adapter)

    # load adapter
    Object.const_get(adapter)
  end
end<commit_msg>Added support for ruby 1.9.<commit_after>class ApplicationLib

=begin

load adapter based on setting option

  result = self.load_adapter_by_setting( 'some_setting_with_class_name' )

returns

  result = Some::Classname

=end

  def self.load_adapter_by_setting(setting)
    adapter = Setting.get( setting )
    return if !adapter

    # load backend
    self.load_adapter(adapter)
  end

=begin

load adapter

  result = self.load_adapter( 'Some::Classname' )

returns

  result = Some::Classname

=end

  def self.load_adapter(adapter)

    # load adapter

    # will only work on ruby 2.0
#    Object.const_get(adapter)

    # will work on ruby 1.9 and 2.0
#    adapter.split('::').inject(Object) do |mod, class_name|
#      mod.const_get(class_name)
#    end

    # will work with active_support
    adapter.constantize
  end
end
{'fraction_non_alphanumeric': 0.08144475920679886, 'fraction_numerical': 0.0056657223796034, 'mean_word_length': 3.5876623376623376, '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': '4402743', 'n_tokens_mistral': 479, 'n_tokens_neox': 452, 'n_words': 117}