I have a Sinatra application that, when cooked, looks basically like this:
class MyApp < Sinatra::Base configure :production do myConfigVar = read_config_file() end configure :development do myConfigVar = read_config_file() end def read_config_file()
Unfortunately this does not work. I get an undefined method read_config_file for MyApp:Class (NoMethodError)
The logic in read_config_file
non-trivial, so I don't want to duplicate it in both. How can I determine a method that can be called from both of my configuration blocks? Or am I just completely approaching this problem?
source share