<commit_before>class Ld::Sheet
  attr_accessor :excel, :sheet

  ABSCISSA = {}
  if ABSCISSA.empty?
    zm = 'A'
    ABSCISSA[zm] = 0
    19999.times{|i| ABSCISSA[zm.succ!] = i+1}
  end

  def initialize excel, name, type = 'new'
    raise "sheet name is nil" if !name
    @excel = excel
    @name = name
    case type
      when 'new'
        @sheet = excel.create_worksheet :name => name
        @point = 'a1'
        @headings = nil
        @rows = []
      when 'open'
        @sheet = excel.worksheet name
        raise "sheet '#{name}' not found!" if !@sheet
    end
    @format = @sheet.default_format
  end

  # 作用 读sheet页数据,返回二维数组
  def read scope, show_location = false
    raise "scope params is nil" if !scope
    map = read_scope_to_map scope
    read_arrs map, show_location
  end

  # 作用 解析范围参数
  def parse_string_scope scope
    PARAMETER_ERROR.hint_and_raise :scope, "'+' or '-' 只能存在1个" if scope.split('+').size > 2 or scope.split('-').size > 2
    hash = {}
    scope.upcase!<commit_msg>添加读取一行方法<commit_after>class Ld::Sheet
  attr_accessor :excel, :sheet

  ABSCISSA = {}
  if ABSCISSA.empty?
    zm = 'A'
    ABSCISSA[zm] = 0
    19999.times{|i| ABSCISSA[zm.succ!] = i+1}
  end

  def initialize excel, name, type = 'new'
    raise "sheet name is nil" if !name
    @excel = excel
    @name = name
    case type
      when 'new'
        @sheet = excel.create_worksheet :name => name
        @point = 'a1'
        @headings = nil
        @rows = []
      when 'open'
        @sheet = excel.worksheet name
        raise "sheet '#{name}' not found!" if !@sheet
    end
    @format = @sheet.default_format
  end

  # 作用 读sheet页数据,返回二维数组
  def read scope, show_location = false
    raise "scope params is nil" if !scope
    map = read_scope_to_map scope
    read_arrs map, show_location
  end

  # 作用 读取一行
  def read_row i
    @sheet.row(i-1).to_a
  end

  # 作用 解析范围参数
  def parse_string_scope scope
    PARAMETER_ERROR.hint_and_raise :scope, "'+' or '-' 只能存在1个" if scope.split('+').size > 2 or scope.split('-').size > 2
    hash = {}
    scope.upcase!
{'fraction_non_alphanumeric': 0.12052274927395934, 'fraction_numerical': 0.011132623426911906, 'mean_word_length': 2.4856661045531196, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1032534', 'n_tokens_mistral': 826, 'n_tokens_neox': 804, 'n_words': 206}