lib/wordy_number/wordy_match.rb
# it enhances the performance of long numbers carrying 1s or 0s
it enhances the performance of long numbers carrying 1s or 0s
it enhances the performance of long numbers carrying 1s or 0s
def split_arnd_0_1_n_find_matches(num_str=self.num)
      splits = num_str.gsub(/[^01]/, "").split("")
      split_num_str = num_str.split(/[01]/)
      split_results = split_num_str.map do |sub_num_str|
        find_all_matches(sub_num_str)
      end
      combined_splits_and_split_results = []
      split_results.each_index do |index|
        combined_splits_and_split_results << split_results[index]
        combined_splits_and_split_results << [splits[index]] if index <= splits.length - 1
      end
      combined_splits_and_split_results.select!{ |x| x.length > 0 }
      results = self.class.concat_array_of_lists_of_strings(combined_splits_and_split_results)
      results.map!{ |str| self.class.join_numbers_together_in_str(str) }
      self.num_patterns = results
      results
    end
def split_arnd_0_1_n_find_matches ( num_str = self . num ) splits = num_str . gsub ( / [^01] / , "" ) . split ( "" ) split_num_str = num_str . split ( / [01] / ) split_results = split_num_str . map do | sub_num_str | find_all_matches ( sub_num_str ) end combined_splits_and_split_results = [ ] split_results . each_index do | index | combined_splits_and_split_results << split_results [ index ] combined_splits_and_split_results << [ splits [ index ] ] if index <= splits . length - 1 end combined_splits_and_split_results . select! { | x | x . length > 0 } results = self . class . concat_array_of_lists_of_strings ( combined_splits_and_split_results ) results . map! { | str | self . class . join_numbers_together_in_str ( str ) } self . num_patterns = results results end
it enhances the performance of long numbers carrying 1s or 0s
it enhances the performance of long numbers carrying 1s or 0s
# split given number_string at 0's and 1's # obtain patterns for each sub_number_string # obtain combined result # join numbers togeter in each results element # set num_patterns
num_str
<not_specific>
num
<not_specific>