Class: FortranFormatParser::NodeL

Inherits:
Struct
  • Object
show all
Defined in:
ext/fortio/lib/fortio/fortran_format.rb,
ext/fortio/lib/fortio/fortran_format.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#countObject

Returns the value of attribute count

Returns:

  • (Object)

    the current value of count



408
409
410
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 408

def count
  @count
end

#lengthObject

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



408
409
410
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 408

def length
  @length
end

Instance Method Details

#count_argsObject



429
430
431
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 429

def count_args
  return count
end

#inspectObject



432
433
434
435
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 432

def inspect
  count_str = count == 1 ? "" : count.to_s
  return "#{count_str}L#{length}"
end

#read(io, list, state) ⇒ Object



419
420
421
422
423
424
425
426
427
428
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 419

def read (io, list, state)
  count.times do
    case io.read(length)
   when /\A *?\.?t/i
    list.push(true)
  else
   list.push(false)
  end
end      
end

#write(io, list, state) ⇒ Object



410
411
412
413
414
415
416
417
418
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 410

def write (io, list, state)
  count.times do
    if list.shift
      io << " "*(length-1) + "T"
   else
      io << " "*(length-1) + "F"
  end
end
end