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



406
407
408
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 406

def count
  @count
end

#lengthObject

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



406
407
408
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 406

def length
  @length
end

Instance Method Details

#count_argsObject



427
428
429
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 427

def count_args
  return count
end

#inspectObject



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

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

#read(io, list, state) ⇒ Object



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

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



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

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