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



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

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

Instance Method Details

#[](n) ⇒ Object

Accesses flags for character n



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

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

#set_attrs(start, length, bits) ⇒ Object

Toggles bits from start to length



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

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