Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Message
- class << self; attr_accessor :cache; end
- attr_accessor :id
- attr_accessor :body
- def self.find(id)
- new(id,@cache.transaction{|c| c[id] })
- end
- def initialize(id, body)
- self.id = id
- self.body = body.squeeze(' ').strip
- self.class.cache = PStore.new('message_cache.pstore')
- end
- def save
- self.class.cache.transaction{|c| c[@id] = @body }
- end
- def to_html
- @body.gsub(/\n/,"<br/>")
- end
- end
Add Comment
Please, Sign In to add comment