class Ant::Storage::Factory
charge of sending objects into storage and fetching also from them.
Public Class Methods
new(model)
click to toggle source
# File lib/ant/storage/factory.rb, line 9 def initialize(model) @model = model end
Public Instance Methods
create(data, source = resource(:default))
click to toggle source
# File lib/ant/storage/factory.rb, line 13 def create(data, source = resource(:default)) repository = resource(source) model = @model.new(data) model.repository = repository model.create model end
get(id, source = resource(:default))
click to toggle source
# File lib/ant/storage/factory.rb, line 21 def get(id, source = resource(:default)) repository = resource(source) data = repository.get(id) model = @model.new(data) model.repository = repository model end