Class: Runoff::Chat
- Inherits:
-
Object
- Object
- Runoff::Chat
- Defined in:
- lib/runoff/chat.rb
Overview
Public: Reads data from the SQLite database used by Skype/
Instance Method Summary collapse
-
#get_chatname_options ⇒ Object
Public: Creates a collection with all chats available for export.
-
#get_messages ⇒ Object
Public: Returns a list of all the records in the databse.
-
#initialize(db_location, options) ⇒ Chat
constructor
Public: Initializes a Chat object.
Constructor Details
#initialize(db_location, options) ⇒ Chat
Public: Initializes a Chat object.
db_location - A String with a path to the database file.
11 12 13 14 |
# File 'lib/runoff/chat.rb', line 11 def initialize(db_location, ) @messages = Sequel.sqlite(db_location)[Runoff::TABLE] @adapter = Object.const_get("Runoff::Adapters::#{[:adapter]}").new end |
Instance Method Details
#get_chatname_options ⇒ Object
Public: Creates a collection with all chats available for export.
Returns a Set with hashes e.g. [{ id: 12, name: “chatname” }, … ]
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/runoff/chat.rb', line 26 def = Set.new @messages.select(*Runoff::COLUMNS[0..1]).each do |row| readable_name = @adapter.parse_chatname row[Runoff::COLUMNS[1]] << { id: row[Runoff::COLUMNS[0]], name: readable_name } end end |