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 365
365:         def self.dirname
366:           File.dirname(__FILE__) + '/../values/'
367:         end
filename() click to toggle source

Returns the filename for the data file for this version

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

Public Instance Methods

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

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.