Class: Skygrepe::Database
- Inherits:
-
Object
- Object
- Skygrepe::Database
- Defined in:
- lib/skygrepe.rb
Instance Method Summary collapse
- #grep(keyword) ⇒ Object
-
#initialize(path) ⇒ Database
constructor
A new instance of Database.
Constructor Details
#initialize(path) ⇒ Database
7 8 9 |
# File 'lib/skygrepe.rb', line 7 def initialize(path) @impl ||= SQLite3::Database.new(path) end |
Instance Method Details
#grep(keyword) ⇒ Object
11 12 13 14 |
# File 'lib/skygrepe.rb', line 11 def grep(keyword) sql = "SELECT m.timestamp, c.displayname, m.author, m.body_xml FROM Messages as m inner join Conversations as c on m.convo_id = c.id WHERE body_xml like '%#{keyword}%';" rows = @impl.execute(sql) end |