Class: RDoc::RI::AttributeFormatter::AttributeString
- Inherits:
-
Object
- Object
- RDoc::RI::AttributeFormatter::AttributeString
- Defined in:
- lib/rdoc/ri/formatter.rb
Instance Attribute Summary collapse
-
#txt ⇒ Object
readonly
Returns the value of attribute txt.
Instance Method Summary collapse
- #<<(char) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ AttributeString
constructor
A new instance of AttributeString.
-
#next_word ⇒ Object
accept non space, then all following spaces.
Constructor Details
#initialize ⇒ AttributeString
Returns a new instance of AttributeString.
254 255 256 257 |
# File 'lib/rdoc/ri/formatter.rb', line 254 def initialize @txt = [] @optr = 0 end |
Instance Attribute Details
#txt ⇒ Object (readonly)
Returns the value of attribute txt.
252 253 254 |
# File 'lib/rdoc/ri/formatter.rb', line 252 def txt @txt end |
Instance Method Details
#<<(char) ⇒ Object
259 260 261 |
# File 'lib/rdoc/ri/formatter.rb', line 259 def <<(char) @txt << char end |
#empty? ⇒ Boolean
263 264 265 |
# File 'lib/rdoc/ri/formatter.rb', line 263 def empty? @optr >= @txt.length end |
#next_word ⇒ Object
accept non space, then all following spaces
268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/rdoc/ri/formatter.rb', line 268 def next_word start = @optr len = @txt.length while @optr < len && @txt[@optr].char != " " @optr += 1 end while @optr < len && @txt[@optr].char == " " @optr += 1 end @txt[start...@optr] end |