Class: Muzang::Plugins::Grep::Message

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/muzang-plugins/muzang-grep.rb

Defined Under Namespace

Classes: Migration

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.like(channel, term) ⇒ Object



18
19
20
# File 'lib/muzang-plugins/muzang-grep.rb', line 18

def self.like(channel, term)
  find(:all, :conditions => ['channel LIKE ? AND content MATCH ?' , channel, term], :order => 'created_at DESC', :limit => 20)
end

Instance Method Details

#to_textObject



22
23
24
# File 'lib/muzang-plugins/muzang-grep.rb', line 22

def to_text
  ["### #{user} @ #{created_at}:", "> #{content}", ''].join("\n")
end