<commit_before>module Lotus
  class Action
    def initialize(options)
      @controller = constantize(options.fetch(:controller))
      @action     = options.fetch(:action) {|e| :index }
    end

    def call(env)
      @controller.new(env).call(@action)
    end

    private
    def constantize(controller)
      Object.const_get "#{ controller.to_s.capitalize }Controller"
    end
  end
end
<commit_msg>Lazy evaluation of controller name<commit_after>module Lotus
  class Action
    def initialize(options)
      @controller_name = options.fetch(:controller)
      @action          = options.fetch(:action) {|e| :index }
    end

    def call(env)
      controller.new(env).call(@action)
    end

    private
    def controller
      @controller ||= constantize_controller_name
    end

    def constantize_controller_name
      Object.const_get "#{ @controller_name.to_s.capitalize }Controller"
    end
  end
end

{'fraction_non_alphanumeric': 0.09596510359869138, 'fraction_numerical': 0.0, 'mean_word_length': 3.0087336244541483, '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': '2598529', 'n_tokens_mistral': 276, 'n_tokens_neox': 268, 'n_words': 61}