I’m creating my own plugin that I want to use in different projects. And
because my different projects need different configurations of the
plugin I’d like to provide an easy way to configure them, maybe
something like the following:
you can achieve that by defining a module in your plugin lib directory
and then defining mattr_accessors for your configuration values. With
that, you are really defining class_level variables (so they will
persist during the whole application life) and the corresponding
accessors for getting and setting them.
Actually that’s my favourite way of defining configuration variables for
my plugins, since you can easily provide default values and at the same
time anyone using the plugin has a place where to look for the available
configuration options.
regards,
Javier
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.