<commit_before>module Cucumber
  module Salad
    module Widgets
      class List < Widget
        DEFAULT_TYPE = Atom

        include Enumerable

        def_delegators :items, :size, :include?, :each, :empty?, :first

        def self.item(selector, type = DEFAULT_TYPE, &item_for)
          define_method :item_selector do
            @item_selector ||= selector
          end

          if block_given?
            define_method :item_for, &item_for
          else
            define_method :item_factory do
              type
            end
          end
        end

        def to_table
          items.map { |e| Array(e) }
        end

        protected

        attr_writer :item_selector<commit_msg>Let List respond to #last.<commit_after>module Cucumber
  module Salad
    module Widgets
      class List < Widget
        DEFAULT_TYPE = Atom

        include Enumerable

        def_delegators :items, :size, :include?, :each, :empty?, :first, :last

        def self.item(selector, type = DEFAULT_TYPE, &item_for)
          define_method :item_selector do
            @item_selector ||= selector
          end

          if block_given?
            define_method :item_for, &item_for
          else
            define_method :item_factory do
              type
            end
          end
        end

        def to_table
          items.map { |e| Array(e) }
        end

        protected

        attr_writer :item_selector
{'fraction_non_alphanumeric': 0.06241331484049931, 'fraction_numerical': 0.0, 'mean_word_length': 1.6094032549728752, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6795754', 'n_tokens_mistral': 401, 'n_tokens_neox': 386, 'n_words': 110}