Class: SycLink::InternetExplorer

Inherits:
Importer
  • Object
show all
Defined in:
lib/syclink/internet_explorer.rb

Overview

Importer for Internet Explorer

Instance Attribute Summary

Attributes inherited from Importer

#opts, #path

Instance Method Summary collapse

Methods inherited from Importer

#initialize, #links, #rows

Constructor Details

This class inherits a constructor from SycLink::Importer

Instance Method Details

#readObject

Reads the links from the Internet Explorer’s bookmarks directory



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/syclink/internet_explorer.rb', line 10

def read
  files = Dir.glob(File.join(path, "**/*"))
  
  regex = Regexp.new("(?<=#{path}).*")

  files.map do |file|
    unless ((File.directory? file) || (File.extname(file).upcase != ".URL"))
      url = File.read(file).scan(/(?<=\nURL=)(.*)$/).flatten.first
      name = File.basename(file, ".*")
      description = ""
      tag         = extract_tags(File.dirname(file).scan(regex))
      [url, name, description, tag]
    end
  end.compact
end