Class: RDoc::RI::AttributeFormatter::AttributeString

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc/ri/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAttributeString

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

#txtObject (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

Returns:

  • (Boolean)


263
264
265
# File 'lib/rdoc/ri/formatter.rb', line 263

def empty?
  @optr >= @txt.length
end

#next_wordObject

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