Class: FunctionsFramework::Function::CallBase

Inherits:
Object
  • Object
show all
Defined in:
lib/functions_framework/function.rb

Overview

A base class for a callable object that provides calling context.

An object of this class is self while a function block is running.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**context) ⇒ CallBase

Create a callable object with the given context.

Parameters:

  • context (keywords)

    A set of context arguments. See #context for a list of keys that will generally be passed in. However, implementations should be prepared to accept any abritrary keys.



113
114
115
# File 'lib/functions_framework/function.rb', line 113

def initialize **context
  @context = context
end

Instance Attribute Details

#contextHash (readonly)

A keyed hash of context information. Common context keys include:

  • :logger (Logger) A logger for use by this function call.
  • :function_name (String) The name of the running function.
  • :function_type (Symbol) The type of the running function, either :http or :cloud_event.

Returns:

  • (Hash)


127
128
129
# File 'lib/functions_framework/function.rb', line 127

def context
  @context
end