<commit_before>require File.join(File.dirname(__FILE__), 'base_downloader')
require File.join(File.dirname(__FILE__), 'utils')

Dir[File.dirname(__FILE__) + '/commands/**/*_cmd.rb'].each do |file|
  require file
end

require File.join(File.dirname(__FILE__), 'middleware/middleware')

module GoodData::Bricks
  class Pipeline
    def self.prepare(pipeline)
      pipeline.reverse.reduce(nil) {|memo, app| memo.nil? ? app.new : app.new(memo)}
    end
  end

  # Brick base class
  class Brick

    def log(message)
      logger = @params[:gdc_logger]
      logger.info(message) unless logger.nil?
    end

    def name
      self.class
    end

    def version
      fail "Method version should be reimplemented"
    end

    def call(params={})
      @params = params
      ""
    end

  end
  
end<commit_msg>Ability to use class in a pipeline<commit_after>require File.join(File.dirname(__FILE__), 'base_downloader')
require File.join(File.dirname(__FILE__), 'utils')

Dir[File.dirname(__FILE__) + '/commands/**/*_cmd.rb'].each do |file|
  require file
end

require File.join(File.dirname(__FILE__), 'middleware/middleware')

module GoodData::Bricks
  class Pipeline
    def self.prepare(pipeline)
      pipeline.reverse.reduce(nil) do |memo, app|
        if memo.nil?
          app.respond_to?(:new) ? (puts "new"; app.new) : app
        else
          app.respond_to?(:new) ? (puts "new"; app.new(memo)) : (app.app = memo; app)
        end
      end
    end
  end

  # Brick base class
  class Brick

    def log(message)
      logger = @params[:gdc_logger]
      logger.info(message) unless logger.nil?
    end

    def name
      self.class
    end

    def version
      fail "Method version should be reimplemented"
    end

    def call(params={})
      @params = params
      ""
    end

  end
  
end
{'fraction_non_alphanumeric': 0.11988950276243093, 'fraction_numerical': 0.0, 'mean_word_length': 2.836864406779661, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4305031', 'n_tokens_mistral': 599, 'n_tokens_neox': 590, 'n_words': 146}