lib/roda.rb in roda-3.38.0 vs lib/roda.rb in roda-3.39.0

- old
+ new

@@ -112,10 +112,11 @@ temp_method = roda_method_name("temp") class_eval("def #{temp_method}(_) #{meth =~ /\A\w+\z/ ? "#{meth}_arity" : "send(:\"#{meth}_arity\")"} end", __FILE__, __LINE__) alias_method meth, temp_method undef_method temp_method private meth + alias_method meth, meth meth = :"#{meth}_arity" elsif required_args > 1 b = block block = lambda{|r| instance_exec(r, &b)} # Fallback end @@ -142,10 +143,11 @@ end end define_method(meth, &block) private meth + alias_method meth, meth if arity_meth required_args, optional_args, rest, keyword = _define_roda_method_arg_numbers(instance_method(meth)) max_args = required_args + optional_args define_method(arity_meth) do |*a| @@ -165,10 +167,11 @@ end send(meth, *a) end private arity_meth + alias_method arity_meth, arity_meth end call_meth end @@ -197,10 +200,11 @@ if instance_method(:set_default_headers).owner == ResponseMethods && instance_method(:default_headers).owner == ResponseMethods private + alias set_default_headers set_default_headers def set_default_headers @headers['Content-Type'] ||= 'text/html' end end end @@ -401,10 +405,11 @@ class_eval("alias _roda_before #{meths.first}", __FILE__, __LINE__) else class_eval("def _roda_before; #{meths.join(';')} end", __FILE__, __LINE__) end private :_roda_before + alias_method :_roda_before, :_roda_before end end # Build a _roda_after method that calls each _roda_after_* method # in order, if any _roda_after_* methods are defined. Also, use @@ -417,9 +422,10 @@ class_eval("alias _roda_after #{meths.first}", __FILE__, __LINE__) else class_eval("def _roda_after(res); #{meths.map{|s| "#{s}(res)"}.join(';')} end", __FILE__, __LINE__) end private :_roda_after + alias_method :_roda_after, :_roda_after end end # The route block to use when building the rack app (or other initial # entry point to the route block).