Class: TamTam::LogSet
- Inherits:
-
Object
- Object
- TamTam::LogSet
- 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
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#matches ⇒ Object
Returns the value of attribute matches.
Instance Method Summary collapse
- #as(*accounts) ⇒ Object
- #between(start, stop) ⇒ Object
-
#initialize(adapter) ⇒ LogSet
constructor
A new instance of LogSet.
- #messages ⇒ Object
- #on(start) ⇒ Object
- #to_s ⇒ Object (also: #inspect)
- #with(*participants) ⇒ Object
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
#adapter ⇒ Object
Returns the value of attribute adapter.
9 10 11 |
# File 'lib/tam_tam/log_set.rb', line 9 def adapter @adapter end |
#matches ⇒ Object
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 |
#messages ⇒ Object
16 17 18 |
# File 'lib/tam_tam/log_set.rb', line 16 def @messages ||= MessageSet.new(adapter.(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_s ⇒ Object 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 |