From be7012e90f721aefe317b16989102051b3bf7b4f Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Sun, 29 Sep 2013 23:42:39 +0200 Subject: [PATCH] Use a hash for options (future proof) --- lib/opal/sprockets/server.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/opal/sprockets/server.rb b/lib/opal/sprockets/server.rb index b4d131e..117c7ff 100644 --- a/lib/opal/sprockets/server.rb +++ b/lib/opal/sprockets/server.rb @@ -37,10 +37,18 @@ class Server attr_accessor :debug, :index_path, :main, :public_dir, :sprockets - def initialize debug = true + def initialize debug_or_options = {} + unless Hash === debug_or_options + warn "passing a boolean to control debug is deprecated.\n"+ + "Please pass an Hash instead: Server.new(debug: true)" + options = {debug: debug_or_options} + else + options = debug_or_options + end + @public_dir = '.' @sprockets = Environment.new - @debug = debug + @debug = options.fetch(:debug, true) yield self if block_given? create_app