class Sticky::Note

Attributes

db[RW]
message[RW]
tag[RW]
timestamp[RW]

Public Class Methods

build(message, tag = nil, db = Sticky::Store.new) click to toggle source
# File lib/sticky/note.rb, line 8
def build(message, tag = nil, db = Sticky::Store.new)
  new(message, tag, db)
end
delete!(tag, db = Sticky::Store.new) click to toggle source
# File lib/sticky/note.rb, line 18
def delete!(tag, db = Sticky::Store.new)
  db.delete!(tag)
end
new(message, tag, db, timestamp = Time.now) click to toggle source
# File lib/sticky/note.rb, line 23
def initialize(message, tag, db, timestamp = Time.now)
  @message = message
  @db = db
  @tag = tag
  @timestamp = timestamp
end
show(tag, date, db = Sticky::Store.new) click to toggle source
# File lib/sticky/note.rb, line 12
def show(tag, date, db = Sticky::Store.new)
  db.fetch(tag, date) do |note|
    puts "#{note.timestamp} #{note.message}"
  end
end

Public Instance Methods

save!() click to toggle source
# File lib/sticky/note.rb, line 30
def save!
  db.save!(self)
end
to_yaml_properties() click to toggle source
# File lib/sticky/note.rb, line 34
def to_yaml_properties
  [:@message, :@tag, :@timestamp]
end