module MR::ReadModel::Data
Protected Instance Methods
read_model_data()
click to toggle source
`MR::ReadModel::Data` is a mixin that provides helpers for setting and accessing the “data” for a read model. These methods provide a strict interface to avoid confusing errors and ensure that the data for a read model should, as much as possible, work.
-
Use the `read_model_data` protected method to access the data object.
-
Use the `set_read_model_data` private method to write a data object.
# File lib/mr/read_model/data.rb, line 16 def read_model_data @read_model_data || raise(NoDataError.new(caller)) end
Private Instance Methods
set_read_model_data(data)
click to toggle source
# File lib/mr/read_model/data.rb, line 22 def set_read_model_data(data) raise InvalidDataError unless data.respond_to?(:[]) @read_model_data = data end