Class: VFCSV::Instance
Overview
Instance wrapper for stateful CSV operations
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #headers ⇒ Object
-
#initialize(data = nil, **options) ⇒ Instance
constructor
A new instance of Instance.
- #read ⇒ Object
Constructor Details
#initialize(data = nil, **options) ⇒ Instance
Returns a new instance of Instance.
530 531 532 533 534 |
# File 'lib/vfcsv.rb', line 530 def initialize(data = nil, **) @data = data = VFCSV::DEFAULT_OPTIONS.merge() @rows = nil end |
Instance Method Details
#each(&block) ⇒ Object
536 537 538 539 540 |
# File 'lib/vfcsv.rb', line 536 def each(&block) return to_enum(__method__) unless block_given? ensure_parsed @rows.each(&block) end |
#headers ⇒ Object
547 548 549 550 |
# File 'lib/vfcsv.rb', line 547 def headers ensure_parsed @rows.respond_to?(:headers) ? @rows.headers : nil end |
#read ⇒ Object
542 543 544 545 |
# File 'lib/vfcsv.rb', line 542 def read ensure_parsed @rows end |