Class: RDocF95::RI::AttributeFormatter::AttributeString

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAttributeString

Returns a new instance of AttributeString.



241
242
243
244
# File 'lib/rdoc-f95/ri/formatter.rb', line 241

def initialize
  @txt = []
  @optr = 0
end

Instance Attribute Details

#txtObject (readonly)

Returns the value of attribute txt.



239
240
241
# File 'lib/rdoc-f95/ri/formatter.rb', line 239

def txt
  @txt
end

Instance Method Details

#<<(char) ⇒ Object



246
247
248
# File 'lib/rdoc-f95/ri/formatter.rb', line 246

def <<(char)
  @txt << char
end

#empty?Boolean

Returns:

  • (Boolean)


250
251
252
# File 'lib/rdoc-f95/ri/formatter.rb', line 250

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

#next_wordObject

accept non space, then all following spaces



255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/rdoc-f95/ri/formatter.rb', line 255

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