Class: FortranFormatParser::NodeF
- Inherits:
-
Struct
- Object
- Struct
- FortranFormatParser::NodeF
- Defined in:
- ext/fortio/lib/fortio/fortran_format.rb,
ext/fortio/lib/fortio/fortran_format.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#length ⇒ Object
Returns the value of attribute length.
-
#prec ⇒ Object
Returns the value of attribute prec.
Instance Method Summary collapse
- #count_args ⇒ Object
- #inspect ⇒ Object
- #read(io, list, state) ⇒ Object
- #write(io, list, state) ⇒ Object
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count
483 484 485 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 483 def count @count end |
#length ⇒ Object
Returns the value of attribute length
483 484 485 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 483 def length @length end |
#prec ⇒ Object
Returns the value of attribute prec
483 484 485 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 483 def prec @prec end |
Instance Method Details
#count_args ⇒ Object
503 504 505 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 503 def count_args return count end |
#inspect ⇒ Object
506 507 508 509 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 506 def inspect count_str = count == 1 ? "" : count.to_s return "#{count_str}F#{length}.#{prec}" end |
#read(io, list, state) ⇒ Object
491 492 493 494 495 496 497 498 499 500 501 502 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 491 def read (io, list, state) str = nil count.times do str = io.read(length) if state.zero str = str.gsub(/ /,'0') end list << FortranFormat.read_F(str, state.scale, length, prec) end rescue raise "reading error in fortran format : #{str.dump} for #{self.inspect}" end |
#write(io, list, state) ⇒ Object
485 486 487 488 489 490 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 485 def write (io, list, state) count.times do str = FortranFormat.write_F(state.sign, state.scale, length, prec, list.shift) io << FortranFormat.check_length(length, str) end end |