Class: FortranFormatParser::NodeES
- Inherits:
-
Struct
- Object
- Struct
- FortranFormatParser::NodeES
- 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.
-
#exp ⇒ Object
Returns the value of attribute exp.
-
#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
542 543 544 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 542 def count @count end |
#exp ⇒ Object
Returns the value of attribute exp
542 543 544 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 542 def exp @exp end |
#length ⇒ Object
Returns the value of attribute length
542 543 544 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 542 def length @length end |
#prec ⇒ Object
Returns the value of attribute prec
542 543 544 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 542 def prec @prec end |
Instance Method Details
#count_args ⇒ Object
562 563 564 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 562 def count_args return count end |
#inspect ⇒ Object
565 566 567 568 569 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 565 def inspect count_str = count == 1 ? "" : count.to_s exp_str = (exp.nil? or exp == 2) ? "" : "E#{exp}" return "#{count_str}ES#{length}.#{prec}#{exp_str}" end |
#read(io, list, state) ⇒ Object
550 551 552 553 554 555 556 557 558 559 560 561 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 550 def read (io, list, state) str = nil count.times do str = io.read(length) if state.zero str = str.gsub(/ /,'0') end list << str.to_f end rescue raise "reading error in fortran format : #{str.dump} for #{self.inspect}" end |
#write(io, list, state) ⇒ Object
544 545 546 547 548 549 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 544 def write (io, list, state) count.times do str = FortranFormat.write_E(state.sign, 1, length, prec, exp, list.shift) io << FortranFormat.check_length(length, str) end end |