Method: Jets::Resource::Lambda::Function#function_name

Defined in:
lib/jets/resource/lambda/function.rb

#function_nameObject

Examples:

"#{Jets.config.project_namespace}-sleep_job-perform"
"demo-dev-sleep_job-perform"


190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/jets/resource/lambda/function.rb', line 190

def function_name
  # Example values:
  #   @app_class: admin/pages_controller
  #   @task.meth: index
  #   method: admin/pages_controller
  #   method: admin-pages_controller-index
  method = @app_class.underscore
  method = method.gsub('/','-').gsub(/[^0-9a-z\-_]/i, '') + "-#{@task.meth}"
  function_name = "#{Jets.config.project_namespace}-#{method}"
  # Returns nil if function name is too long.
  # CloudFormation will managed the the function name in this case.
  # A pretty function name won't be generated but the deploy will be successful.
  function_name.size > Jets::MAX_FUNCTION_NAME_SIZE ? nil : function_name
end