Module: JsChat::Storage::NullDriver
- Defined in:
- lib/jschat/storage/null.rb
Class Method Summary collapse
- .delete_user(user) ⇒ Object
- .find_user(options) ⇒ Object
- .lastlog(number, room) ⇒ Object
- .log(message, room) ⇒ Object
- .save_user(user) ⇒ Object
- .search(query, room, limit) ⇒ Object
Class Method Details
.delete_user(user) ⇒ Object
30 31 |
# File 'lib/jschat/storage/null.rb', line 30 def self.delete_user(user) end |
.find_user(options) ⇒ Object
24 25 |
# File 'lib/jschat/storage/null.rb', line 24 def self.find_user() end |
.lastlog(number, room) ⇒ Object
12 13 14 15 |
# File 'lib/jschat/storage/null.rb', line 12 def self.lastlog(number, room) @messages ||= [] @messages.select { |m| m['room'] == room }.reverse[0..number].reverse end |
.log(message, room) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/jschat/storage/null.rb', line 5 def self.log(, room) @messages ||= [] ['room'] = room @messages.push @messages = @messages[-MEMORY_MESSAGE_LIMIT..-1] if @messages.size > MEMORY_MESSAGE_LIMIT end |
.save_user(user) ⇒ Object
27 28 |
# File 'lib/jschat/storage/null.rb', line 27 def self.save_user(user) end |
.search(query, room, limit) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/jschat/storage/null.rb', line 17 def self.search(query, room, limit) @messages ||= [] @messages.select do |m| m['message'] and m['message']['message'].match(query) and m['room'] == room end.reverse[0..limit].reverse end |