Module: Euston::Projections::MongoProjection::InstanceMethods
- Defined in:
- lib/euston-projections/mongo_projection.rb
Instance Method Summary collapse
- #act_as(role) ⇒ Object
- #add_to_history(message_id) ⇒ Object
- #already_processed_message?(*message_ids) ⇒ Boolean
- #processed_message_ids ⇒ Object
- #prune_history_older_than(time) ⇒ Object
Instance Method Details
#act_as(role) ⇒ Object
35 36 37 |
# File 'lib/euston-projections/mongo_projection.rb', line 35 def act_as(role) role.new(self) end |
#add_to_history(message_id) ⇒ Object
18 19 20 21 |
# File 'lib/euston-projections/mongo_projection.rb', line 18 def add_to_history return if << HistoricalMessage.new(message_id: ) end |
#already_processed_message?(*message_ids) ⇒ Boolean
23 24 25 |
# File 'lib/euston-projections/mongo_projection.rb', line 23 def * ( & ).size == .size end |
#processed_message_ids ⇒ Object
27 28 29 |
# File 'lib/euston-projections/mongo_projection.rb', line 27 def .map { |m| m. } end |
#prune_history_older_than(time) ⇒ Object
31 32 33 |
# File 'lib/euston-projections/mongo_projection.rb', line 31 def prune_history_older_than time .reject! { |m| m. < time } end |