Class: RDoc::Markup::AttrSpan

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc/markup/inline.rb

Overview

An array of attributes which parallels the characters in a string.

Instance Method Summary (collapse)

Constructor Details

- (AttrSpan) initialize(length)

Creates a new AttrSpan for length characters



75
76
77
# File 'lib/rdoc/markup/inline.rb', line 75

def initialize(length)
  @attrs = Array.new(length, 0)
end

Instance Method Details

- (Object) [](n)

Accesses flags for character n



90
91
92
# File 'lib/rdoc/markup/inline.rb', line 90

def [](n)
  @attrs[n]
end

- (Object) set_attrs(start, length, bits)

Toggles bits from start to length



81
82
83
84
85
# File 'lib/rdoc/markup/inline.rb', line 81

def set_attrs(start, length, bits)
  for i in start ... (start+length)
    @attrs[i] |= bits
  end
end