<commit_before>module Base

  class Generator
    class Tag
      delegate :view, :klass, to: :@parent
      delegate :t, :capture_haml, :haml_tag, :haml_concat, to: :view

      def initialize(parent, opts)
        @parent = parent
        @opts   = opts
      end

      protected
        def force_presence(value)
          if @opts.fetch(:present, nil)
            value.presence || t(:empty).html_safe
          else
            value
          end
        end
    end

    def initialize(view, data, opts = {})
      @view = view
      @data = data
      @opts = opts
    end

    attr_reader :view, :opts

    delegate :capture_haml, :haml_tag, to: :@view

    def to_s
      raise "To be implemented"
    end

    def klass
      raise "To be implemented"
    end

    def method_missing name, *args, &block
      begin
        @view.send(name, *args)
      rescue
        super
      end
    end

  end
end
<commit_msg>Don't swallow blocks in method_missing (and why we do have method_missing, still?)<commit_after>module Base

  class Generator
    class Tag
      delegate :view, :klass, to: :@parent
      delegate :t, :capture_haml, :haml_tag, :haml_concat, to: :view

      def initialize(parent, opts)
        @parent = parent
        @opts   = opts
      end

      protected
        def force_presence(value)
          if @opts.fetch(:present, nil)
            value.presence || t(:empty).html_safe
          else
            value
          end
        end
    end

    def initialize(view, data, opts = {})
      @view = view
      @data = data
      @opts = opts
    end

    attr_reader :view, :opts

    delegate :capture_haml, :haml_tag, to: :@view

    def to_s
      raise "To be implemented"
    end

    def klass
      raise "To be implemented"
    end

    def method_missing name, *args, &block
      begin
        @view.send(name, *args, &block)
      rescue
        super
      end
    end

  end
end

{'fraction_non_alphanumeric': 0.08535954474909467, 'fraction_numerical': 0.0, 'mean_word_length': 1.7747489239598278, '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': '4080993', 'n_tokens_mistral': 606, 'n_tokens_neox': 592, 'n_words': 184}