Skip to content

Instantly share code, notes, and snippets.

@bezelga
Created September 3, 2014 15:29
Show Gist options
  • Save bezelga/3e75ca9f9f776e6e127d to your computer and use it in GitHub Desktop.
Save bezelga/3e75ca9f9f776e6e127d to your computer and use it in GitHub Desktop.
module Tod
module TasksRepository
class InMemory
def initialize
@tasks = {}
@id = 0
end
def persist(task)
@id += 1
task.id = @id
tasks[@id] = task
task
end
def count
tasks.length
end
private
attr_reader :tasks
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment