class SycLink::Firefox

Importer for Firefox links

Importer for Firefox links

Constants

QUERY_STRING

Query strig to read links from the Firefox database places.sqlite

Public Instance Methods

read() click to toggle source

Reads the links from the Firefox database places.sqlite

# File lib/syclink/firefox.rb, line 14
def read
  bookmark_file = Dir.glob(File.expand_path(path)).shift
  raise "Did not find file #{path}" unless bookmark_file

  db = SQLite3::Database.new(path)

  import = db.execute(QUERY_STRING)
end
rows() click to toggle source

Returns row values in Arrays

# File lib/syclink/firefox.rb, line 24
def rows
  read.map do |row|
    a = row[0]; b = row[1]; c = row[2]; d = row[3]; e = row[4]; f = row[5]
    [a, 
     b || c, 
     (d || '').gsub("\n", ' '), 
     [e, f].join(',').gsub(/^,|,$/, '')]
  end
end