Class: SM::AttrSpan

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

Overview

An array of attributes which parallels the characters in a string

Instance Method Summary collapse

Constructor Details

#initialize(length) ⇒ AttrSpan

Returns a new instance of AttrSpan.



53
54
55
# File 'lib/rdoc/markup/simple_markup/inline.rb', line 53

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

Instance Method Details

#[](n) ⇒ Object



63
64
65
# File 'lib/rdoc/markup/simple_markup/inline.rb', line 63

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

#set_attrs(start, length, bits) ⇒ Object



57
58
59
60
61
# File 'lib/rdoc/markup/simple_markup/inline.rb', line 57

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