Sha256: fd94d2f76aa031bcd12a8eb08306f570ba73169a2f6a45a7cf7138c14cdb9791

Contents?: true

Size: 731 Bytes

Versions: 3

Compression:

Stored size: 731 Bytes

Contents

require 'json'
require_relative 'processor_deducer'

# Global overrides for Lambda processing
$stdout.sync = true
# This might seem weird but we want puts to write to stderr which is set in
# the node shim to write to stderr.  This directs the output to Lambda logs.
# Printing to stdout can managle up the payload returned from Lambda function.
# This is not desired if you want to return say a json payload to API Gateway
# eventually.
def puts(text)
  $stderr.puts(text)
end

class Lam::Process::BaseProcessor
  attr_reader :event, :context, :handler
  def initialize(event, context, handler)
    # assume valid json from Lambda
    @event = JSON.parse(event)
    @context = JSON.parse(context)
    @handler = handler
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lam-0.1.2 lib/lam/process/base_processor.rb
lam-0.1.1 lib/lam/process/base_processor.rb
lam-0.0.1 lib/lam/process/base_processor.rb