Class: FirefoxJson::Session::Session
- Inherits:
-
Base
- Object
- Base
- FirefoxJson::Session::Session
show all
- Defined in:
- lib/firefox-json/session.rb
Overview
A collection of windows, both current and previous
Instance Attribute Summary
Attributes inherited from Base
#path
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
children, choose_for, #dump, #eql?, inherited, #initialize, #inspect, mattr_accessor, #reload, required_key=, #save, set_collection
Class Method Details
.default_file(path) ⇒ Object
262
263
264
265
|
# File 'lib/firefox-json/session.rb', line 262
def self.default_file(path)
Dir["#{path}/sessionstore.jsonlz4",
"#{path}/sessionstore.js"][0]
end
|
.file(path) ⇒ Object
272
273
274
|
# File 'lib/firefox-json/session.rb', line 272
def self.file(path)
default_file(path) || recovery_file(path)
end
|
.recovery_file(path) ⇒ Object
267
268
269
270
|
# File 'lib/firefox-json/session.rb', line 267
def self.recovery_file(path)
Dir["#{path}/sessionstore-backups/recovery.jsonlz4",
"#{path}/sessionstore-backups/recovery.js"][0]
end
|
Instance Method Details
#current_urls ⇒ Object
251
252
253
|
# File 'lib/firefox-json/session.rb', line 251
def current_urls
windows.map(&:current_urls)
end
|
#to_s ⇒ Object
255
256
257
258
259
260
|
# File 'lib/firefox-json/session.rb', line 255
def to_s
closed_text = ' closed='+closed_windows.size.to_s if closed_windows.size>0
fname = File.basename(path).split('.')[0..-2].join('.')
warning = fname if fname != 'sessionstore'
"#<FirefoxJson::Session##{warning} windows=#{windows.size}#{closed_text}>"
end
|