Method: Calculator#fib

Defined in:
src/ruby/bin/math_server.rb

#fib(fib_args, _call) ⇒ Object



116
117
118
119
120
121
122
123
124
# File 'src/ruby/bin/math_server.rb', line 116

def fib(fib_args, _call)
  if fib_args.limit < 1
    fail StatusError.new(Status::INVALID_ARGUMENT, 'limit must be >= 0')
  end

  # return an Enumerator of Nums
  Fibber.new(fib_args.limit).generator
  # just return the generator, GRPC::GenericServer sends each actual response
end