Class: FortranFormatParser::NodeA
- Inherits:
-
Struct
- Object
- Struct
- FortranFormatParser::NodeA
- 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.
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
370 371 372 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 370 def count @count end |
#length ⇒ Object
Returns the value of attribute length
370 371 372 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 370 def length @length end |
Instance Method Details
#count_args ⇒ Object
397 398 399 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 397 def count_args return count end |
#inspect ⇒ Object
400 401 402 403 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 400 def inspect count_str = count == 1 ? "" : count.to_s return "#{count_str}A#{length}" end |
#read(io, list, state) ⇒ Object
387 388 389 390 391 392 393 394 395 396 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 387 def read (io, list, state) str = nil if length list << (str = io.read(length)) else list << (str = io.read) end rescue raise "reading error in fortran format : #{str.dump} for #{self.inspect}" end |
#write(io, list, state) ⇒ Object
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
# File 'ext/fortio/lib/fortio/fortran_format.rb', line 372 def write (io, list, state) len = length if len count.times do str = list.shift if str.length > len io << str[0,len] else io << str.rjust(len) end end else io << str end end |