Rahul Sekhar
Rahul Sekhar

Reputation: 2841

Ruby gem with persistent data

I need to create a gem, for my own use, that substitutes the current 'libnotify' gem as I find it unusable to have my testing notifications queued one after the other. I'll use dbus-send to create the notifications, and get their ID. Now I need some way of storing this ID between each code run so that I can retrieve it when a new notification is created and replace the notification instead of queuing a new one.

So how and where do I store this temporary data with my gem? All it needs is a simple scratch file, but it's not one I can delete after use. What would the best practise be for this?

Upvotes: 0

Views: 87

Answers (1)

Oscar Del Ben
Oscar Del Ben

Reputation: 4515

One common idiom is to use an hidden folder in your home directory.

~/.mygem/data

Upvotes: 1

Related Questions