Class: Alexandria::CSVImport

Inherits:
Object
  • Object
show all
Defined in:
lib/alexandria/import_library_csv.rb

Direct Known Subclasses

GoodreadsCSVImport, LibraryThingCSVImport

Instance Method Summary collapse

Constructor Details

#initialize(header) ⇒ CSVImport

Returns a new instance of CSVImport.



30
31
32
33
# File 'lib/alexandria/import_library_csv.rb', line 30

def initialize(header)
  @header = header
  @html = HTMLEntities.new
end

Instance Method Details

#index_of(header_name) ⇒ Object



35
36
37
38
39
40
# File 'lib/alexandria/import_library_csv.rb', line 35

def index_of(header_name)
  @header.each_with_index do |h, i|
    return i if h == header_name
  end
  -1
end

#normalize(string) ⇒ Object



42
43
44
# File 'lib/alexandria/import_library_csv.rb', line 42

def normalize(string)
  @html.decode(string).strip
end