Class: Abtab::Driver

Inherits:
Object
  • Object
show all
Defined in:
lib/abtab/driver.rb

Direct Known Subclasses

CSVDriver, DbiDriver, TabDriver, XlsDriver

Defined Under Namespace

Classes: CSVDriver, DbiDriver, TabDriver, XlsDriver

Instance Method Summary collapse

Instance Method Details

#import(inp) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/abtab/driver.rb', line 8

def import inp
  set_columns inp.columns
  while rec = inp.next_record
    break if rec.nil?
    write_record rec
  end
end

#url_parse(url, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/abtab/driver.rb', line 16

def url_parse url, options={}
  schema, rest = url.split '://', 2
  path, qs = rest.split '?', 2
  if qs
    qs.split(/[;&]/).each do |pair|
      k,v = pair.split '='
      k = URI.unescape k
      v = URI.unescape v
      options[k] = v
    end
  end
  return schema, path, options
end