Sha256: 3e3c11ea8f8482d542005b7884bc344b9a34c907b71f572ba7b950ede1c043e0

Contents?: true

Size: 1.5 KB

Versions: 4

Compression:

Stored size: 1.5 KB

Contents

require "json"

# Jets::Lambda::Functions represents a collection of Lambda functions.
#
# Jets::Lambda::Functions is the superclass of:
#   Jets::Event::Base
module Jets::Lambda
  class Functions
    include Jets::ExceptionReporting
    include Jets::Util::Logging

    attr_reader :event, :context, :meth
    def initialize(event, context, meth)
      @event = HashWithIndifferentAccess.new(event) # Hash, JSON.parse(event) ran BaseProcessor
      @context = context # Hash. JSON.parse(context) ran in BaseProcessor
      @meth = meth # useful to identify which template to use later.
    end

    include Dsl # At the end so methods like event, context and method
    # do not trigger method_added

    # Pretty hacky since action_view/rendering.rb _normalize_options calls super
    def _normalize_options(options) # :doc:
      options
    end

    class << self
      include Jets::Util::Logging

      attr_reader :abstract
      alias_method :abstract?, :abstract
      @abstract = true

      def inherited(base)
        super
        subclasses << base if base.name
      end

      # Define a controller as abstract. See internal_methods for more details.
      def abstract!
        @abstract = true
      end

      def _prefixes
        []
      end

      # Tracking subclasses because it helps with Lambda::Dsl#find_all_definitions
      def subclasses
        @subclasses ||= []
      end

      # Needed for depends_on. Got added due to stagger logic.
      def output_keys
        []
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jets-6.0.5 lib/jets/lambda/functions.rb
jets-6.0.4 lib/jets/lambda/functions.rb
jets-6.0.3 lib/jets/lambda/functions.rb
jets-6.0.2 lib/jets/lambda/functions.rb