<commit_before>module ProMotion
  module Table

    include ProMotion::Styling
    include ProMotion::Table::Searchable
    include ProMotion::Table::Refreshable
    include ProMotion::Table::Indexable

    def table_view
      @table_view ||= begin
        t = UITableView.alloc.initWithFrame(self.view.frame, style: table_style)
        t.dataSource = self
        t.delegate = self
        t
      end
    end

    def table_style
      UITableViewStylePlain
    end

    def screen_setup
      check_table_data
      set_up_table_view
      set_up_searchable
      set_up_refreshable
    end

    def check_table_data
      PM.logger.error "Missing #table_data method in TableScreen #{self.class.to_s}." unless self.respond_to?(:table_data)
    end

    def set_up_table_view
      self.view = self.create_table_view_from_data(self.table_data)
    end

    def set_up_searchable
      if self.class.respond_to?(:get_searchable) && self.class.get_searchable
        self.make_searchable(content_controller: self, search_bar: self.class.get_searchable_params)
      end
    end

    def set_up_refreshable
      if self.class.respond_to?(:get_refreshable) && self.class.get_refreshable
        if defined?(UIRefreshControl)
          self.make_refreshable(self.class.get_refreshable_params)
        else
          PM.logger.warn "To use the refresh control on < iOS 6, you need to include the CocoaPod 'CKRefreshControl'."
        end
      end
    end

    def create_table_view_from_data(data)
      @promotion_table_data = TableData.new(data, table_view)
      table_view
    end

    def searching?
      @promotion_table_data.filtered
    end
<commit_msg>fix a timing to create table_view and call on_load<commit_after>module ProMotion
  module Table

    include ProMotion::Styling
    include ProMotion::Table::Searchable
    include ProMotion::Table::Refreshable
    include ProMotion::Table::Indexable

    def table_view
      @table_view ||= begin
        t = UITableView.alloc.initWithFrame(self.view.frame, style: table_style)
        t.dataSource = self
        t.delegate = self
        t
      end
    end

    def table_style
      UITableViewStylePlain
    end

    def screen_setup
      check_table_data
      set_up_table_view
      set_up_searchable
      set_up_refreshable
    end

    def check_table_data
      PM.logger.error "Missing #table_data method in TableScreen #{self.class.to_s}." unless self.respond_to?(:table_data)
    end

    def set_up_table_view
      # before access self.table_data, create UITableView and call on_load
      table_view

      self.view = self.create_table_view_from_data(self.table_data)
    end

    def set_up_searchable
      if self.class.respond_to?(:get_searchable) && self.class.get_searchable
        self.make_searchable(content_controller: self, search_bar: self.class.get_searchable_params)
      end
    end

    def set_up_refreshable
      if self.class.respond_to?(:get_refreshable) && self.class.get_refreshable
        if defined?(UIRefreshControl)
          self.make_refreshable(self.class.get_refreshable_params)
        else
          PM.logger.warn "To use the refresh control on < iOS 6, you need to include the CocoaPod 'CKRefreshControl'."
        end
      end
    end

    def create_table_view_from_data(data)
      @promotion_table_data = TableData.new(data, table_view)
      table_view
    end

    def searching?
      @promotion_table_data.filtered
    end

{'fraction_non_alphanumeric': 0.06572090330052113, 'fraction_numerical': 0.0005790387955993051, 'mean_word_length': 2.8863892013498313, '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': '4123842', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1048, 'n_words': 227}