<commit_before>module View
  macro context(*args)
    def initialize(
      {% for arg in args %}
        @{{arg.id}}
      {% end %})
    end
  end

  macro view_file(file, a=__DIR__)
    ecr_file "{{a.id}}/{{file.id}}.ecr"
  end

  macro view(name, path=__DIR__)
    class {{name.id.capitalize}}View < Base::View
      def initialize(controller)
        @controller = controller
      end
      ecr_file "{{path.id}}/{{name.id}}.ecr"
    end
  end

  macro render(view_klass)
    _view = {{view_klass.id.capitalize}}View.new(controller=self)
    @response.body = _view.render
  end<commit_msg>add simple layout support<commit_after>module View
  macro context(*args)
    def initialize(
      {% for arg in args %}
        @{{arg.id}}
      {% end %})
    end
  end

  macro view_file(file, a=__DIR__)
    ecr_file "{{a.id}}/{{file.id}}.ecr"
  end

  macro view(name, path=__DIR__)
    class {{name.id.capitalize}}View < Base::View
      def initialize(controller)
        @controller = controller
      end
      ecr_file "{{path.id}}/{{name.id}}.ecr"
    end
  end

  macro render(view_klass)
    _view = {{view_klass.id.capitalize}}View.new(controller=self)
    @response.body = _view.render
  end

  macro layout(name, path=_DIR_)
    class {{name.id.capitalize}}View < Base::View
      def initialize(controller, view)
        @controller = controller
        @view = view
      end
      ecr_file "{{path.id}}/{{name.id}}.ecr"
    end
  end

  macro render_with_layout(view_klass, layout_klass)
    _view = {{view_klass.id.capitalize}}View.new(controller=self)
    _layout = {{layout_klass.id.capitalize}}View.new(controller=self, view =
                                                     _view.render)
    @response.body = _layout.render
  end
{'fraction_non_alphanumeric': 0.1379703534777651, 'fraction_numerical': 0.0, 'mean_word_length': 2.588957055214724, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4708875', 'n_tokens_mistral': 603, 'n_tokens_neox': 580, 'n_words': 116}