Class: RDoc::Markup::AttrSpan

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

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(length) ⇒ AttrSpan

Creates a new AttrSpan for length characters



9
10
11
# File 'lib/rdoc/markup/attr_span.rb', line 9

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

Instance Method Details

#[](n) ⇒ Object

Accesses flags for character n



24
25
26
# File 'lib/rdoc/markup/attr_span.rb', line 24

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

#set_attrs(start, length, bits) ⇒ Object

Toggles bits from start to length



15
16
17
18
19
# File 'lib/rdoc/markup/attr_span.rb', line 15

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