Method: Mail::Multibyte::Unicode::UnicodeDatabase#load

Defined in:
lib/mail/multibyte/unicode.rb

#loadObject

Loads the Unicode database and returns all the internal objects of UnicodeDatabase.



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/mail/multibyte/unicode.rb', line 354

def load
  begin
    @codepoints, @composition_exclusion, @composition_map, @boundary, @cp1252 = File.open(self.class.filename, 'rb') { |f| Marshal.load f.read }
  rescue => e
      raise IOError.new("Couldn't load the Unicode tables for UTF8Handler (#{e.message}), Mail::Multibyte is unusable")
  end

  # Redefine the === method so we can write shorter rules for grapheme cluster breaks
  @boundary.each do |k,_|
    @boundary[k].instance_eval do
      def ===(other)
        detect { |i| i === other } ? true : false
      end
    end if @boundary[k].kind_of?(Array)
  end

  # define attr_reader methods for the instance variables
  class << self
    attr_reader(*ATTRIBUTES)
  end
end