Module: Hanami::Lambda Private

Defined in:
lib/hanami/lambda.rb,
lib/hanami/lambda/rack.rb,
lib/hanami/lambda/event.rb,
lib/hanami/lambda/types.rb,
lib/hanami/lambda/version.rb,
lib/hanami/lambda/function.rb,
lib/hanami/lambda/dispatcher.rb,
lib/hanami/lambda/application.rb,
lib/hanami/lambda/events/base.rb,
lib/hanami/lambda/events/event_bridge.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Make Hanami can be run on AWS Lambda.

Since:

  • 0.1.0

Defined Under Namespace

Modules: Application, Events, Types Classes: Dispatcher, Event, Function, Rack

Constant Summary collapse

LAMBDA_EVENT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

"lambda.event"
LAMBDA_CONTEXT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

"lambda.context"
LAMBDA_CONFIG_PATH =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.2.0

File.join("config", "lambda")
LAMBDA_CLASS_NAME =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.2.0

"Lambda"
VERSION =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

"0.2.4"
HANDLER_KEY_NAMESPACE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

"functions"

Class Method Summary collapse

Class Method Details

.appHanami::Lambda::Application

Return the application

Returns:

Since:

  • 0.1.0



35
36
37
# File 'lib/hanami/lambda.rb', line 35

def self.app
  Hanami.app
end

.call(event:, context:) ⇒ Object

Run the application

Since:

  • 0.1.0



42
43
44
45
46
# File 'lib/hanami/lambda.rb', line 42

def self.call(event:, context:)
  require "bundler/setup"
  app.boot
  app.handle_lambda(event: event, context: context)
end

.gem_loaderObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/hanami/lambda.rb', line 66

def self.gem_loader
  @gem_loader ||= Zeitwerk::Loader.new.tap do |loader|
    root = File.expand_path("..", __dir__ || "")
    loader.tag = "hanami-lambda"
    loader.inflector = Zeitwerk::GemInflector.new("#{root}/hanami-lambda.rb")
    loader.push_dir(root)
    loader.ignore(
      "#{root}/hanami-lambda.rb",
      "#{root}/hanami/lambda/{rake_tasks,version}.rb",
      "#{root}/hanami/lambda/support"
    )
    loader.inflector.inflect("lambda" => "Lambda")
  end
end

.inflectorDry::Inflector

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Inflector to convert event key

Returns:

  • (Dry::Inflector)

Since:

  • 0.2.0



54
55
56
57
58
59
60
61
62
# File 'lib/hanami/lambda.rb', line 54

def self.inflector
  @_mutex.synchronize do
    return @inflector if defined?(@inflector)

    @inflector ||= Dry::Inflector.new
  end

  @inflector
end