class Replay::Rails::ActiveRecordEventStore::Event

Public Class Methods

delete(*args) click to toggle source
# File lib/replay/rails.rb, line 25
def self.delete(*args)
  raise ActiveRecord::ReadOnlyRecord.new
end
delete_all(*args) click to toggle source
# File lib/replay/rails.rb, line 21
def self.delete_all(*args)
  raise ActiveRecord::ReadOnlyRecord.new
end
event_stream(stream_id) click to toggle source
# File lib/replay/rails.rb, line 57
def self.event_stream(stream_id)
  events_for(stream_id).to_a.map(&:envelope)
end
events_for(stream_id) click to toggle source
# File lib/replay/rails.rb, line 53
def self.events_for(stream_id)
  where(:stream_id => stream_id).order('created_at asc')
end

Public Instance Methods

delete() click to toggle source
# File lib/replay/rails.rb, line 17
def delete
  raise ActiveRecord::ReadOnlyRecord.new
end
destroy() click to toggle source
# File lib/replay/rails.rb, line 14
def destroy
  raise ActiveRecord::ReadOnlyRecord.new
end
envelope() click to toggle source
# File lib/replay/rails.rb, line 45
def envelope
  @envelope ||= Replay::EventEnvelope.new(
    stream_id,
    event,
    envelope_data
  )
end
event() click to toggle source
# File lib/replay/rails.rb, line 29
def event
  if data.is_a? String
    event_type.constantize.new(JSON.parse(data))
  else
    event_type.constantize.new(data)
  end
end
metadata() click to toggle source
# File lib/replay/rails.rb, line 37
def metadata
  if envelope_data.is_a? String
    JSON.parse(envelope_data)
  else
    envelope_data
  end
end
readonly?() click to toggle source
# File lib/replay/rails.rb, line 10
def readonly?
  persisted?
end