Browse Source

Update roda-sequel to use correct block arity (#4615)

The static_get blocks are supposed to accept a request
argument.  They have always been yielded a request argument,
it has just been ignored by this code (Ruby blocks are not
strict in regards to arity).

Starting in the most recent release of Roda, there is a
significant performance improvement by have the block
accept an argument.
Jeremy Evans 6 years ago
parent
commit
046e1b40c6
1 changed files with 6 additions and 6 deletions
  1. 6 6
      frameworks/Ruby/roda-sequel/hello_world.rb

+ 6 - 6
frameworks/Ruby/roda-sequel/hello_world.rb

@@ -26,17 +26,17 @@ class HelloWorld < Roda
   end
   end
 
 
   # Test type 1: JSON serialization
   # Test type 1: JSON serialization
-  static_get '/json' do
+  static_get '/json' do |_|
     { :message=>'Hello, World!' }
     { :message=>'Hello, World!' }
   end
   end
 
 
   # Test type 2: Single database query
   # Test type 2: Single database query
-  static_get '/db' do
+  static_get '/db' do |_|
     World.with_pk(rand1).values
     World.with_pk(rand1).values
   end
   end
 
 
   # Test type 3: Multiple database queries
   # Test type 3: Multiple database queries
-  static_get '/queries' do
+  static_get '/queries' do |_|
     worlds =
     worlds =
       DB.synchronize do
       DB.synchronize do
         Array.new(bounded_queries) do
         Array.new(bounded_queries) do
@@ -48,7 +48,7 @@ class HelloWorld < Roda
   end
   end
 
 
   # Test type 4: Fortunes
   # Test type 4: Fortunes
-  static_get '/fortunes' do
+  static_get '/fortunes' do |_|
     @fortunes = Fortune.all
     @fortunes = Fortune.all
     @fortunes << Fortune.new(
     @fortunes << Fortune.new(
       :id=>0,
       :id=>0,
@@ -60,7 +60,7 @@ class HelloWorld < Roda
   end
   end
 
 
   # Test type 5: Database updates
   # Test type 5: Database updates
-  static_get '/updates' do
+  static_get '/updates' do |_|
     worlds =
     worlds =
       DB.synchronize do
       DB.synchronize do
         Array.new(bounded_queries) do
         Array.new(bounded_queries) do
@@ -74,7 +74,7 @@ class HelloWorld < Roda
   end
   end
 
 
   # Test type 6: Plaintext
   # Test type 6: Plaintext
-  static_get '/plaintext' do
+  static_get '/plaintext' do |_|
     response['Content-Type'] = 'text/plain'
     response['Content-Type'] = 'text/plain'
 
 
     'Hello, World!'
     'Hello, World!'