class Runoff::Chat
Public: Reads data from the SQLite database used by Skype/
Public Class Methods
new(db_location, options)
click to toggle source
Public: Initializes a Chat
object.
db_location - A String with a path to the database file.
# File lib/runoff/chat.rb, line 11 def initialize(db_location, options) @messages = Sequel.sqlite(db_location)[Runoff::TABLE] @adapter = Object.const_get("Runoff::Adapters::#{options[:adapter]}").new end
Public Instance Methods
get_chatname_options()
click to toggle source
Public: Creates a collection with all chats available for export.
Returns a Set with hashes e.g. [{ id: 12, name: “chatname” }, … ]
# File lib/runoff/chat.rb, line 26 def get_chatname_options options = Set.new @messages.select(*Runoff::COLUMNS[0..1]).each do |row| readable_name = @adapter.parse_chatname row[Runoff::COLUMNS[1]] options << { id: row[Runoff::COLUMNS[0]], name: readable_name } end options end
get_messages()
click to toggle source
Public: Returns a list of all the records in the databse.
# File lib/runoff/chat.rb, line 17 def get_messages @messages.select(*Runoff::COLUMNS).all.sort_by do |row| [row[Runoff::COLUMNS[0]], row[Runoff::COLUMNS[2]]] end end