summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/config.rb14
-rw-r--r--registration.rb2
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/config.rb b/lib/config.rb
new file mode 100644
index 0000000..bc42c34
--- /dev/null
+++ b/lib/config.rb
@@ -0,0 +1,14 @@
+require 'yaml'
+
+class Config
+ attr_reader :contact_email
+
+ def self.load
+ conf = YAML.load(IO.read("config.yml"))
+ Config.new(conf)
+ end
+
+ def initialize(conf)
+ @contact_email = conf['contact_email']
+ end
+end
diff --git a/registration.rb b/registration.rb
index e3bf571..34baf84 100644
--- a/registration.rb
+++ b/registration.rb
@@ -2,6 +2,7 @@ require 'sinatra/base'
require 'sinatra/url_for'
require 'tilt/erb'
require_relative 'lib/registration'
+require_relative 'lib/config'
class RegistrationApp < Sinatra::Base
helpers Sinatra::UrlForHelper
@@ -10,6 +11,7 @@ class RegistrationApp < Sinatra::Base
enable :sessions
get '/' do
+ @config = Config.load
@band = Band.new
3.times { @band.songs << Song.new }
erb :index