Class: FDK::Function
- Inherits:
-
Object
- Object
- FDK::Function
- Defined in:
- lib/fdk/function.rb
Overview
Function represents a function function or lambda
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#function ⇒ Object
readonly
Returns the value of attribute function.
Instance Method Summary collapse
- #as_proc ⇒ Object
- #call(request:, response:) ⇒ Object
-
#initialize(function:, format:) ⇒ Function
constructor
A new instance of Function.
Constructor Details
#initialize(function:, format:) ⇒ Function
Returns a new instance of Function.
24 25 26 27 28 29 |
# File 'lib/fdk/function.rb', line 24 def initialize(function:, format:) raise "'#{format}' not supported in Ruby FDK." unless format == "http-stream" @format = format @function = function end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
22 23 24 |
# File 'lib/fdk/function.rb', line 22 def format @format end |
#function ⇒ Object (readonly)
Returns the value of attribute function.
22 23 24 |
# File 'lib/fdk/function.rb', line 22 def function @function end |
Instance Method Details
#as_proc ⇒ Object
31 32 33 34 35 |
# File 'lib/fdk/function.rb', line 31 def as_proc return function if function.respond_to?(:call) ->(context:, input:) { send(function, context: context, input: input) } end |