<commit_before>module Tgios
  class UITableViewListBinding < BindingBase
    def initialize
      @events={}
      @events[:build_cell]=->(cell_identifier) { build_cell(cell_identifier) }.weak!
      @events[:update_cell]=->(record, cell, index_path) { update_cell_text(record, cell, index_path)}.weak!
    end

    def bind(tableView, list, display_field, options={})
      @tableView=WeakRef.new(tableView)
      @tableView.dataSource=self
      @tableView.delegate=self
      @display_field=display_field
      set_list(list)
      @options=(options || {})
      return self
    end

    def on(event_name, &block)
      @events[event_name]=block.weak!
      self
    end

    def reload(list)
      set_list(list)
      @tableView.reloadData()
    end

    def set_list(list)
      @list=WeakRef.new(list)
      @page = 1
      @total = nil
    end

    def build_cell(cell_identifier)
      cell=UITableViewCell.alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier: cell_identifier)
      cell.textLabel.adjustsFontSizeToFitWidth = true
      if @options[:lines] && @options[:lines] != 1
        cell.textLabel.numberOfLines = 0
      end
      cell.clipsToBounds = true
      cell
    end

    def update_cell_text(record, cell, index_path)
      cell.textLabel.text=record[@display_field]
      cell
    end

    def tableView(tableView, cellForRowAtIndexPath: index_path)
      record = @list[index_path.row]
      cell_identifier = "CELL_IDENTIFIER"
      cell=tableView.dequeueReusableCellWithIdentifier(cell_identifier)
      cell = @events[:build_cell].call(cell_identifier) if cell.nil?
      @events[:update_cell].call(record, cell, index_path)
      cell

    end

    def tableView(tableView, didSelectRowAtIndexPath:index_path)
      @events[:touch_row].call(@list[index_path.row], event: {tableView: tableView, didSelectRowAtIndexPath:index_path}) if @events.has_key?(:touch_row)
    end
<commit_msg>reset loading for load more event in table view list binding<commit_after>module Tgios
  class UITableViewListBinding < BindingBase
    def initialize
      @events={}
      @events[:build_cell]=->(cell_identifier) { build_cell(cell_identifier) }.weak!
      @events[:update_cell]=->(record, cell, index_path) { update_cell_text(record, cell, index_path)}.weak!
    end

    def bind(tableView, list, display_field, options={})
      @tableView=WeakRef.new(tableView)
      @tableView.dataSource=self
      @tableView.delegate=self
      @display_field=display_field
      set_list(list)
      @options=(options || {})
      return self
    end

    def on(event_name, &block)
      @events[event_name]=block.weak!
      self
    end

    def reload(list)
      set_list(list)
      @tableView.reloadData()
    end

    def set_list(list)
      @list=WeakRef.new(list)
      @page = 1
      @total = nil
      @loading = nil
    end

    def build_cell(cell_identifier)
      cell=UITableViewCell.alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier: cell_identifier)
      cell.textLabel.adjustsFontSizeToFitWidth = true
      if @options[:lines] && @options[:lines] != 1
        cell.textLabel.numberOfLines = 0
      end
      cell.clipsToBounds = true
      cell
    end

    def update_cell_text(record, cell, index_path)
      cell.textLabel.text=record[@display_field]
      cell
    end

    def tableView(tableView, cellForRowAtIndexPath: index_path)
      record = @list[index_path.row]
      cell_identifier = "CELL_IDENTIFIER"
      cell=tableView.dequeueReusableCellWithIdentifier(cell_identifier)
      cell = @events[:build_cell].call(cell_identifier) if cell.nil?
      @events[:update_cell].call(record, cell, index_path)
      cell

    end

    def tableView(tableView, didSelectRowAtIndexPath:index_path)
      @events[:touch_row].call(@list[index_path.row], event: {tableView: tableView, didSelectRowAtIndexPath:index_path}) if @events.has_key?(:touch_row)
    end

{'fraction_non_alphanumeric': 0.10437881873727088, 'fraction_numerical': 0.0015274949083503055, 'mean_word_length': 3.4647727272727273, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2258280', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1220, 'n_words': 222}