In Files

  • test-unit-3.3.7/lib/test/unit/diff.rb

Class/Module Index [+]

Quicksearch

Test::Unit::Diff::UTF8Line

Public Class Methods

new(line) click to toggle source
 
               # File test-unit-3.3.7/lib/test/unit/diff.rb, line 373
def initialize(line)
  @line = line
  @characters = @line.unpack("U*")
end
            
wide_character?(character) click to toggle source
 
               # File test-unit-3.3.7/lib/test/unit/diff.rb, line 348
def wide_character?(character)
  binary_search_ranges(character, WIDE_CHARACTERS) or
    binary_search_ranges(character, AMBIGUOUS)
end
            

Public Instance Methods

[](*args) click to toggle source
 
               # File test-unit-3.3.7/lib/test/unit/diff.rb, line 378
def [](*args)
  result = @characters[*args]
  if result.respond_to?(:pack)
    result.pack("U*")
  else
    result
  end
end
            
compute_width(start, _end) click to toggle source
 
               # File test-unit-3.3.7/lib/test/unit/diff.rb, line 399
def compute_width(start, _end)
  width = 0
  start.upto(_end - 1) do |i|
    if self.class.wide_character?(@characters[i])
      width += 2
    else
      width += 1
    end
  end
  width
end
            
each(&block) click to toggle source
 
               # File test-unit-3.3.7/lib/test/unit/diff.rb, line 387
def each(&block)
  @characters.each(&block)
end
            
size() click to toggle source
 
               # File test-unit-3.3.7/lib/test/unit/diff.rb, line 391
def size
  @characters.size
end
            
to_s() click to toggle source
 
               # File test-unit-3.3.7/lib/test/unit/diff.rb, line 395
def to_s
  @line
end