Skip to content

Instantly share code, notes, and snippets.

@BrianJoyce
Created October 15, 2012 08:46
Show Gist options
  • Save BrianJoyce/3891505 to your computer and use it in GitHub Desktop.
Save BrianJoyce/3891505 to your computer and use it in GitHub Desktop.
todo_stuff
class Todo
@@todo_id = 0
attr_accessor :todo
def initialize(todo)
@todo = {}
text(todo)
date_time(Time.now)
todo_id
end
def todo_id
@todo.merge!(:id => @@todo_id)
@@todo_id +=1
end
def complete?
@todo[complete]
end
def tags(tag)
@todo.merge!(:tag => tag)
end
def text(text)
@todo.merge!(:text => text)
end
def date_time(time=Time.now)
@todo.merge!(:time => time)
end
end
my_todo = Todo.new("this is a test")
puts my_todo.inspect
my_todo2 = Todo.new("this is a test too")
puts my_todo2.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment