<commit_before><commit_msg>Added simple adapter cascade implementation<commit_after>require 'rails3_datamapper/adapters/benchmarking_adapter'

module Rails
  module DataMapper
    module Adapters

      class Cascade

        def self.setup(base_adapter)
          cascade.instantiate(base_adapter)
        end

        def self.push(adapter)
          cascade.push(adapter)
        end

        def self.cascade
          @cascade ||= new
        end


        def instantiate(adapter, idx = 0)
          if idx < @cascade.size
            instantiate(@cascade[idx], idx + 1).new(adapter)
          else
            adapter
          end
        end

        def push(adapter)
          @cascade << adapter
        end

        private

        def initialize
          @cascade, @adapter = [], nil
        end

      end

    end
  end
end
{'fraction_non_alphanumeric': 0.06658739595719382, 'fraction_numerical': 0.0035671819262782403, 'mean_word_length': 1.6561514195583595, 'pattern_counts': {'":': 0, '<': 6, '<?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': '4990741', 'n_tokens_mistral': 248, 'n_tokens_neox': 222, 'n_words': 57}