In Files

  • test-unit-3.3.4/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.4/lib/test/unit/diff.rb, line 374
def initialize(line)
  @line = line
  @characters = @line.unpack("U*")
end
            
wide_character?(character) click to toggle source
 
               # File test-unit-3.3.4/lib/test/unit/diff.rb, line 349
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.4/lib/test/unit/diff.rb, line 379
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.4/lib/test/unit/diff.rb, line 400
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.4/lib/test/unit/diff.rb, line 388
def each(&block)
  @characters.each(&block)
end
            
size() click to toggle source
 
               # File test-unit-3.3.4/lib/test/unit/diff.rb, line 392
def size
  @characters.size
end
            
to_s() click to toggle source
 
               # File test-unit-3.3.4/lib/test/unit/diff.rb, line 396
def to_s
  @line
end