Search code examples
rubynotificationsrubygemslibnotify

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?


Solution

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

    ~/.mygem/data