Class: TamTam::LogSet

Inherits:
Object
  • Object
show all
Defined in:
lib/tam_tam/log_set.rb

Overview

A set of chat logs. Responsible for filtering at the chat log level. Delegates to the adapter for client-specific behavior.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter) ⇒ LogSet

Returns a new instance of LogSet.



11
12
13
14
# File 'lib/tam_tam/log_set.rb', line 11

def initialize(adapter)
  self.adapter = adapter
  self.matches = adapter.default_matches
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



9
10
11
# File 'lib/tam_tam/log_set.rb', line 9

def adapter
  @adapter
end

#matchesObject

Returns the value of attribute matches.



9
10
11
# File 'lib/tam_tam/log_set.rb', line 9

def matches
  @matches
end

Instance Method Details

#as(*accounts) ⇒ Object



20
21
22
# File 'lib/tam_tam/log_set.rb', line 20

def as(*accounts)
  filter(adapter.as(accounts))
end

#between(start, stop) ⇒ Object



33
34
35
36
37
# File 'lib/tam_tam/log_set.rb', line 33

def between(start, stop)
  start = Chronic.parse(start) if start.is_a?(String)
  stop = Chronic.parse(stop) if stop.is_a?(String)
  filter(adapter.between(start, stop))
end

#messagesObject



16
17
18
# File 'lib/tam_tam/log_set.rb', line 16

def messages
  @messages ||= MessageSet.new(adapter.load_messages(matches))
end

#on(start) ⇒ Object



28
29
30
31
# File 'lib/tam_tam/log_set.rb', line 28

def on(start)
  start = Chronic.parse(start) if start.is_a?(String)
  filter(adapter.on(start))
end

#to_sObject Also known as: inspect



39
40
41
# File 'lib/tam_tam/log_set.rb', line 39

def to_s
  %{#<#{self.class.name}:0x#{object_id.to_s(16)} adapter=#{adapter.to_s}>}
end

#with(*participants) ⇒ Object



24
25
26
# File 'lib/tam_tam/log_set.rb', line 24

def with(*participants)
  filter(adapter.with(participants))
end