class Fabrique::Test::Fixtures::Repository::CustomerRepository
Attributes
data_mapper[R]
Exposed for testing
store[R]
Exposed for testing
Public Class Methods
new(store, data_mapper)
click to toggle source
# File lib/fabrique/test/fixtures/repository.rb, line 24 def initialize(store, data_mapper) @store, @data_mapper = store, data_mapper end
Public Instance Methods
locate(entity_id)
click to toggle source
# File lib/fabrique/test/fixtures/repository.rb, line 35 def locate(entity_id) @data_mapper.from_dto(@store.find(:customer, entity_id)) end
persist(entity)
click to toggle source
# File lib/fabrique/test/fixtures/repository.rb, line 28 def persist(entity) id = @store.save(:customer, @data_mapper.to_dto(entity)) if !id.nil? entity.id = id end end