Class: Jets::Lambda::Function

Inherits:
Functions show all
Defined in:
lib/jets/lambda/function.rb

Instance Attribute Summary

Attributes inherited from Functions

#context, #event, #meth

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Functions

inherited, output_keys, subclasses

Methods included from Dsl

#lambda_functions

Constructor Details

#initializeFunction

Override and change the signature so we do not have to provide info at initialization. So:

hello_function = HelloFunction.new
hello_function.lambda_handler(event, context)

Normally controller and job functions initialize like this:

controller = PostController.new(event, context, "handler_handler")


12
13
# File 'lib/jets/lambda/function.rb', line 12

def initialize
end

Class Method Details

.handlerObject



15
16
17
# File 'lib/jets/lambda/function.rb', line 15

def self.handler
  handler_task.meth
end

.handler_taskObject



19
20
21
# File 'lib/jets/lambda/function.rb', line 19

def self.handler_task
  tasks.first
end

.process(event, context, meth) ⇒ Object

Used by main_processor.rb. Same interface as controllers and jobs.



24
25
26
27
# File 'lib/jets/lambda/function.rb', line 24

def self.process(event, context, meth)
  function = new
  function.send(handler, event, context)
end