You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: unicode_lister.rb
    path of file: ./repos/regexp-examples/scripts
    
    the code of the file until where you have to start completion: require 'pstore'
require_relative '../lib/regexp-examples/unicode_char_ranges'
# A script to generate lis
    
def calculate_ranges(matching_codes)
  return [] if matching_codes.empty?
  first = matching_codes.shift
  matching_codes.inject([first..first]) do |r, x|
    if r.last.last.succ != x
      r << (x..x) # Start new range
    else
      r[0..-2] << (r.last.first..x) # Update last range
    end
  end