Permalink
Browse files

Merge pull request #1409 from namusyaka/cleanup-warnings

Fix many warnings.
  • Loading branch information...
namusyaka committed Sep 13, 2013
2 parents 76aa820 + d475056 commit b46f8fce1fbc011c551caf53313d354ea44bd76e
@@ -103,7 +103,7 @@ def login_from_session
def admin_model_obj
@_admin_model_obj ||= settings.admin_model.constantize
rescue NameError => e
rescue NameError
raise Padrino::Admin::AccessControlError, "You must define an #{settings.admin_model} Model!"
end
end
@@ -179,7 +179,7 @@ def use(m, *args, &block)
#
# @returns The root path of the loaded gem
def gem(name, main_module)
_,spec = Gem.loaded_specs.find { |spec_name, spec| spec_name == name }
_, spec = Gem.loaded_specs.find{|spec_pair| spec_pair[0] == name }
gems << spec
modules << main_module
spec.full_gem_path
@@ -190,9 +190,6 @@ def render(engine, data=nil, options={}, locals={}, &block)
# This means that no engine was explicitly defined
data, engine = *resolve_template(engine, options.dup) if data.nil?
# Setup root
root = settings.respond_to?(:root) ? settings.root : ""
# Use @layout if it exists
layout_was = options[:layout]
options[:layout] = @layout if options[:layout].nil? || options[:layout] == true
@@ -687,9 +687,9 @@ def route(verb, path, *args, &block)
defaults = options.delete(:default_values)
route.add_default_values(defaults) if defaults
end
options.delete_if do |option, args|
options.delete_if do |option, _args|
if route.significant_variable_names.include?(option)
route.add_match_with(option => Array(args).first)
route.add_match_with(option => Array(_args).first)
true
end
end
@@ -721,8 +721,6 @@ def route(verb, path, *args, &block)
# controllers, parents, 'with' parameters, and other options.
#
def parse_route(path, options, verb)
# We need save our originals path/options so we can perform correctly cache.
original = [path, options.dup]
route_options = {}
# We need check if path is a symbol, if that it's a named route.
@@ -997,7 +995,7 @@ def static_file?(path_info)
def static!
if path = static_file?(request.path_info)
env['sinatra.static_file'] = path
cache_control *settings.static_cache_control if settings.static_cache_control?
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file(path, :disposition => nil)
end
end
@@ -67,13 +67,13 @@ def map(options={})
# The call handler setup to route a request given the mappings specified.
def call(env)
rPath = env["PATH_INFO"].to_s
path_info = env["PATH_INFO"].to_s
script_name = env['SCRIPT_NAME']
hHost, sName, sPort = env.values_at('HTTP_HOST','SERVER_NAME','SERVER_PORT')
http_host = env['HTTP_HOST']
@mapping.each do |host, path, match, app|
next unless host.nil? || hHost =~ host
next unless rPath =~ match && rest = $1
next unless host.nil? || http_host =~ host
next unless path_info =~ match && rest = $1
next unless rest.empty? || rest[0] == ?/
rest = "/" if rest.empty?
@@ -83,7 +83,7 @@ def call(env)
'SCRIPT_NAME' => (script_name + path),
'PATH_INFO' => rest))
end
[404, {"Content-Type" => "text/plain", "X-Cascade" => "pass"}, ["Not Found: #{rPath}"]]
[404, {"Content-Type" => "text/plain", "X-Cascade" => "pass"}, ["Not Found: #{path_info}"]]
end
private
@@ -42,7 +42,7 @@ def text_field(field, options={})
@template.text_field_tag field_name(field), options
end
def number_field(field, options={})
def number_field(field, options={})
options.reverse_merge!(:value => field_value(field), :id => field_id(field))
options.merge!(:class => field_error(field, options))
@template.number_field_tag field_name(field), options
@@ -166,7 +166,7 @@ def fields_for(child_association, instance_or_collection=nil, &block)
include_index = default_collection.respond_to?(:each)
nested_options = { :parent => self, :association => child_association }
nested_objects = instance_or_collection ? Array(instance_or_collection) : Array(default_collection)
result = nested_objects.each_with_index.map do |child_instance, index|
nested_objects.each_with_index.map do |child_instance, index|
nested_options[:index] = include_index ? index : nil
@template.fields_for(child_instance, { :nested => nested_options }, &block)
end.join("\n").html_safe

0 comments on commit b46f8fc

Please sign in to comment.