lib/roda/plugins/path.rb in roda-2.4.0 vs lib/roda/plugins/path.rb in roda-2.5.0
- old
+ new
@@ -60,15 +60,14 @@
module Path
DEFAULT_PORTS = {'http' => 80, 'https' => 443}.freeze
OPTS = {}.freeze
# Initialize the path classes when loading the plugin. Options:
- # :by_name :: Register classes by name, which is friendlier when reloading code.
+ # :by_name :: Register classes by name, which is friendlier when reloading code (defaults to
+ # true in development mode)
def self.configure(app, opts=OPTS)
app.instance_eval do
- if opts.has_key?(:by_name)
- self.opts[:path_class_by_name] = opts[:by_name]
- end
+ self.opts[:path_class_by_name] = opts.fetch(:by_name, ENV['RACK_ENV'] == 'development')
self.opts[:path_classes] ||= {}
unless path_block(String)
path(String){|str| str}
end
end