Class: Csv2hash::Adapter::CsvAdapter

Inherits:
Abstract
  • Object
show all
Defined in:
lib/csv2hash/adapters/csv_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ CsvAdapter

Returns a new instance of CsvAdapter.



11
12
13
# File 'lib/csv2hash/adapters/csv_adapter.rb', line 11

def initialize file_path
  self.file_path = file_path
end

Instance Attribute Details

#file_pathObject

Returns the value of attribute file_path.



9
10
11
# File 'lib/csv2hash/adapters/csv_adapter.rb', line 9

def file_path
  @file_path
end

Instance Method Details

#sourceObject



15
16
17
18
# File 'lib/csv2hash/adapters/csv_adapter.rb', line 15

def source
  check_file!
  CSV.read self.file_path
end