Class: RI::AttributeFormatter::AttributeString
- Inherits:
-
Object
- Object
- RI::AttributeFormatter::AttributeString
- Defined in:
- lib/rdoc/ri/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.
270 271 272 273 |
# File 'lib/rdoc/ri/ri_formatter.rb', line 270 def initialize @txt = [] @optr = 0 end |
Instance Attribute Details
#txt ⇒ Object (readonly)
Returns the value of attribute txt
268 269 270 |
# File 'lib/rdoc/ri/ri_formatter.rb', line 268 def txt @txt end |
Instance Method Details
#<<(char) ⇒ Object
275 276 277 |
# File 'lib/rdoc/ri/ri_formatter.rb', line 275 def <<(char) @txt << char end |
#empty? ⇒ Boolean
279 280 281 |
# File 'lib/rdoc/ri/ri_formatter.rb', line 279 def empty? @optr >= @txt.length end |
#next_word ⇒ Object
accept non space, then all following spaces
284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/rdoc/ri/ri_formatter.rb', line 284 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 |