Class: Zillace::Database

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/zillace.rb

Instance Method Summary collapse

Constructor Details

#initialize(profile_prefix: File.join(Dir.home, '.var/app/org.mozilla.firefox')) ⇒ Database

Returns a new instance of Database.



28
29
30
# File 'lib/zillace.rb', line 28

def initialize(profile_prefix: File.join(Dir.home, '.var/app/org.mozilla.firefox'))
  @profile_prefix = profile_prefix
end

Instance Method Details

#connectObject



32
33
34
35
36
37
# File 'lib/zillace.rb', line 32

def connect
  pattern = File.join(@profile_prefix, '.mozilla/firefox/*.default-release/places.sqlite')
  path = Dir[pattern].first or raise Error, "no path"
  @database = SQLite3::Database.new(path)
  self
end