Class: Fabrique::Test::Fixtures::Repository::ProductDataMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/fabrique/test/fixtures/repository.rb

Instance Method Summary collapse

Instance Method Details

#from_dto(dto) ⇒ Object



127
128
129
# File 'lib/fabrique/test/fixtures/repository.rb', line 127

def from_dto(dto)
  Product.new(id: dto[:id], name: dto[:name], price: dto[:price])
end

#to_dto(entity) ⇒ Object



119
120
121
122
123
124
125
# File 'lib/fabrique/test/fixtures/repository.rb', line 119

def to_dto(entity)
  {
    id: entity.id,
    name: entity.name,
    price: entity.price,
  }
end