@@ -134,11 +134,10 @@ class << self
134
134
# end
135
135
#
136
136
# @param name [String] The function name. Defaults to {DEFAULT_TARGET}.
137
- # @param block [Proc] The function code as a proc.
138
137
# @return [self]
139
138
#
140
- def http name = DEFAULT_TARGET , &block
141
- global_registry . add_http name , &block
139
+ def http ( name = DEFAULT_TARGET , &)
140
+ global_registry . add_http ( name , &)
142
141
self
143
142
end
144
143
@@ -164,11 +163,10 @@ def http name = DEFAULT_TARGET, &block
164
163
# @param name [String] The function name. Defaults to {DEFAULT_TARGET}
165
164
# @param request_class [#decode_json] An optional class which will be used to
166
165
# decode the request if it implements a `decode_json` static method.
167
- # @param block [Proc] The function code as a proc @return [self]
168
166
# @return [self]
169
167
#
170
- def typed name = DEFAULT_TARGET , request_class : nil , &block
171
- global_registry . add_typed name , request_class : request_class , &block
168
+ def typed ( name = DEFAULT_TARGET , request_class : nil , &)
169
+ global_registry . add_typed ( name , request_class : request_class , &)
172
170
self
173
171
end
174
172
@@ -187,16 +185,15 @@ def typed name = DEFAULT_TARGET, request_class: nil, &block
187
185
# end
188
186
#
189
187
# @param name [String] The function name. Defaults to {DEFAULT_TARGET}.
190
- # @param block [Proc] The function code as a proc.
191
188
# @return [self]
192
189
#
193
- def cloud_event name = DEFAULT_TARGET , &block
194
- global_registry . add_cloud_event name , &block
190
+ def cloud_event ( name = DEFAULT_TARGET , &)
191
+ global_registry . add_cloud_event ( name , &)
195
192
self
196
193
end
197
194
198
195
##
199
- # Define a server startup task. This is useful for initializing shared
196
+ # Define a server startup task as a block . This is useful for initializing shared
200
197
# resources that should be accessible across all function invocations in
201
198
# this Ruby VM.
202
199
#
@@ -208,11 +205,10 @@ def cloud_event name = DEFAULT_TARGET, &block
208
205
# Startup tasks are passed the {FunctionsFramework::Function} identifying
209
206
# the function to execute, and have no return value.
210
207
#
211
- # @param block [Proc] The startup task
212
208
# @return [self]
213
209
#
214
- def on_startup & block
215
- global_registry . add_startup_task ( &block )
210
+ def on_startup ( & )
211
+ global_registry . add_startup_task ( &)
216
212
self
217
213
end
218
214
@@ -227,7 +223,7 @@ def on_startup &block
227
223
# manipulated to configure the server.
228
224
# @return [FunctionsFramework::Server]
229
225
#
230
- def start target , &block
226
+ def start ( target , &)
231
227
require "functions_framework/server"
232
228
if target . is_a? ::FunctionsFramework ::Function
233
229
function = target
@@ -236,7 +232,7 @@ def start target, &block
236
232
raise ::ArgumentError , "Undefined function: #{ target . inspect } " if function . nil?
237
233
end
238
234
globals = function . populate_globals
239
- server = Server . new function , globals , &block
235
+ server = Server . new ( function , globals , &)
240
236
global_registry . startup_tasks . each do |task |
241
237
task . call function , globals : globals , logger : server . config . logger
242
238
end
@@ -255,8 +251,8 @@ def start target, &block
255
251
# manipulated to configure the server.
256
252
# @return [self]
257
253
#
258
- def run target , &block
259
- server = start target , &block
254
+ def run ( target , &)
255
+ server = start ( target , &)
260
256
server . wait_until_stopped
261
257
self
262
258
end
0 commit comments