<commit_before>require File.expand_path('../../lib/scorched.rb', __FILE__)

class App < Scorched::Controller
end

module Scorched
  module RestActions
    def self.included(klass)
      klass.get('/') { invoke_action :index }
      klass.get('/new') { invoke_action :new }
      klass.post('/') { invoke_action :create }
      klass.get('/:id') { |id| invoke_action :show, id }
      klass.get('/:id/edit') { |id| invoke_action :edit, id }
      klass.route('/:id', method: ['PATCH', 'PUT']) { |id| invoke_action :update, id }
      klass.delete('/:id') { |id| invoke_action :delete, id }
    end
    def invoke_action(action, *captures)
      respond_to?(action) ? send(action, *captures) : pass
    end
  end
end

class Root < App
  include Scorched::RestActions
  def index
    'Hello'
  end

  def create
    'Creating it now'
  end
end

class Customer < App
  include Scorched::RestActions
  def index
    'Hello customer'
  end
end

class Order < App
  include Scorched::RestActions
  def index
    'Me order'
  end
end<commit_msg>Revert "rework as resfult module"<commit_after>require File.expand_path('../../lib/scorched.rb', __FILE__)

class App < Scorched::Controller
end

class Base < App
  def self.inherited(klass)
    klass.get('/') { invoke_action :index }
    klass.get('/new') { invoke_action :new }
    klass.post('/') { invoke_action :create }
    klass.get('/:id') { invoke_action :show }
    klass.get('/:id/edit') { invoke_action :edit }
    klass.route('/:id', method: ['PATCH', 'PUT']) { invoke_action :update }
    klass.delete('/:id') { invoke_action :delete }
  end
  
  def invoke_action(action)
    respond_to?(action) ? send(action) : pass
  end
end

class Root < Base
  def index
    'Hello'
  end
  
  def create
    'Creating it now'
  end
end

class Customer < Base
  def index
    'Hello customer'
  end
end

class Order < Base
  def index
    'Me order'
  end
end
{'fraction_non_alphanumeric': 0.1395471300684571, 'fraction_numerical': 0.0, 'mean_word_length': 3.139433551198257, 'pattern_counts': {'":': 0, '<': 12, '<?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': '2339414', 'n_tokens_mistral': 646, 'n_tokens_neox': 657, 'n_words': 173}