Parent

Class Index [+]

Quicksearch

ActiveSupport::Multibyte::Unicode::UnicodeDatabase

Holds static data from the Unicode database

Constants

ATTRIBUTES

Public Class Methods

dirname() click to toggle source

Returns the directory in which the data files are stored

     # File lib/active_support/multibyte/unicode.rb, line 364
364:         def self.dirname
365:           File.dirname(__FILE__) + '/../values/'
366:         end
filename() click to toggle source

Returns the filename for the data file for this version

     # File lib/active_support/multibyte/unicode.rb, line 369
369:         def self.filename
370:           File.expand_path File.join(dirname, "unicode_tables.dat")
371:         end
new() click to toggle source
     # File lib/active_support/multibyte/unicode.rb, line 322
322:         def initialize
323:           @codepoints = Hash.new(Codepoint.new)
324:           @composition_exclusion = []
325:           @composition_map = {}
326:           @boundary = {}
327:           @cp1252 = {}
328:         end

Public Instance Methods

===(other) click to toggle source
     # File lib/active_support/multibyte/unicode.rb, line 351
351:               def ===(other)
352:                 detect { |i| i === other } ? true : false
353:               end
load() click to toggle source

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

     # File lib/active_support/multibyte/unicode.rb, line 341
341:         def load
342:           begin
343:             @codepoints, @composition_exclusion, @composition_map, @boundary, @cp1252 = File.open(self.class.filename, 'rb') { |f| Marshal.load f.read }
344:           rescue Exception => e
345:               raise IOError.new("Couldn't load the Unicode tables for UTF8Handler (#{e.message}), ActiveSupport::Multibyte is unusable")
346:           end
347: 
348:           # Redefine the === method so we can write shorter rules for grapheme cluster breaks
349:           @boundary.each do |k,_|
350:             @boundary[k].instance_eval do
351:               def ===(other)
352:                 detect { |i| i === other } ? true : false
353:               end
354:             end if @boundary[k].kind_of?(Array)
355:           end
356: 
357:           # define attr_reader methods for the instance variables
358:           class << self
359:             attr_reader(*ATTRIBUTES)
360:           end
361:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.