Class: CloudFormation::FunctionGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/svrless/generators/cloud_formation/function_generator.rb

Overview

Responsible for generating a hash which will eventually look like this:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass:, actions:) ⇒ FunctionGenerator

Returns a new instance of FunctionGenerator.



12
13
14
15
# File 'lib/svrless/generators/cloud_formation/function_generator.rb', line 12

def initialize(klass:, actions:)
  @klass = klass
  @actions = actions
end

Instance Attribute Details

#actionsObject

Returns the value of attribute actions.



10
11
12
# File 'lib/svrless/generators/cloud_formation/function_generator.rb', line 10

def actions
  @actions
end

#klassObject

Returns the value of attribute klass.



10
11
12
# File 'lib/svrless/generators/cloud_formation/function_generator.rb', line 10

def klass
  @klass
end

Instance Method Details

#hash_representationObject



17
18
19
20
21
22
23
24
# File 'lib/svrless/generators/cloud_formation/function_generator.rb', line 17

def hash_representation
  {
    "#{plural_klass_name}_controller": {
      type: "AWS::Serverless::Function",
      properties: properties_hash
    }
  }
end