1## 2# An array of attributes which parallels the characters in a string. 3 4class RDoc::Markup::AttrSpan 5 6 ## 7 # Creates a new AttrSpan for +length+ characters 8 9 def initialize(length) 10 @attrs = Array.new(length, 0) 11 end 12 13 ## 14 # Toggles +bits+ from +start+ to +length+ 15 def set_attrs(start, length, bits) 16 for i in start ... (start+length) 17 @attrs[i] |= bits 18 end 19 end 20 21 ## 22 # Accesses flags for character +n+ 23 24 def [](n) 25 @attrs[n] 26 end 27 28end 29 30