def function(id, props={})
      # Required: code, handler, role, runtime Docs: https://amzn.to/2pdot7S
      meth = sanitize_method_name(id)
      class_namespace = self.to_s.underscore.gsub('/','-') # IE: Jets::Domain => jets-domain
      description = "#{self.to_s} #{meth}" # not bother adding extension
      defaults = {
        code: {
          s3_bucket: "!Ref S3Bucket",
          s3_key: code_s3_key
        },
        role: "!Ref IamRole",
        handler: "#{id}.lambda_handler", # default ruby convention
        runtime: :ruby,
        timeout: Jets.config.function.timeout,
        memory_size: Jets.config.function.memory_size,
        description: description,
      }

      function_name = "#{Jets.config.project_namespace}-#{class_namespace}-#{meth}"
      function_name = function_name.size > MAX_FUNCTION_NAME_SIZE ? nil : function_name
      defaults[:function_name] = function_name if function_name

      props = defaults.merge(props)
      props[:runtime] = "ruby2.5" if props[:runtime].to_s == "ruby"
      props[:handler] = handler(props[:handler])

      logical_id = id.to_s.gsub('/','_')
      resource(logical_id, "AWS::Lambda::Function", props)
    end
def function(id, props={})
      # Required: code, handler, role, runtime Docs: https://amzn.to/2pdot7S
      meth = sanitize_method_name(id)
      class_namespace = self.to_s.underscore.gsub('/','-') # IE: Jets::Domain => jets-domain
      description = "#{self.to_s} #{meth}" # not bother adding extension
      defaults = {
        code: {
          s3_bucket: "!Ref S3Bucket",
          s3_key: code_s3_key
        },
        role: "!Ref IamRole",
        handler: "#{id}.lambda_handler", # default ruby convention
        runtime: :ruby,
        timeout: Jets.config.function.timeout,
        memory_size: Jets.config.function.memory_size,
        description: description,
      }

      function_name = "#{Jets.config.project_namespace}-#{class_namespace}-#{meth}"
      function_name = function_name.size > MAX_FUNCTION_NAME_SIZE ? nil : function_name
      defaults[:function_name] = function_name if function_name

      props = defaults.merge(props)
      props[:runtime] = "ruby2.5" if props[:runtime].to_s == "ruby"
      props[:handler] = handler(props[:handler])

      logical_id = id.to_s.gsub('/','_')
      resource(logical_id, "AWS::Lambda::Function", props)
    end
Example:

   function(:hello,
     handler: handler("hello.lambda_hander"),
     runtime: "python3.6"
   )

 Defaults to ruby. So:

   function(:hello)

 is the same as:

   function(:hello,
     handler: handler("hello.hande"),
     runtime: :ruby
   )