Class: AwsSamYarnBuilder::Template
- Inherits:
-
Object
- Object
- AwsSamYarnBuilder::Template
show all
- Defined in:
- lib/aws_sam_yarn_builder/template.rb
Defined Under Namespace
Classes: FunctionGlobals, FunctionResource
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(path, contents) ⇒ Template
Returns a new instance of Template.
54
55
56
57
|
# File 'lib/aws_sam_yarn_builder/template.rb', line 54
def initialize(path, contents)
self.path = path
self.contents = contents
end
|
Class Method Details
50
51
52
|
# File 'lib/aws_sam_yarn_builder/template.rb', line 50
def self.(file_path)
new file_path, File.read(file_path)
end
|
Instance Method Details
#function_globals ⇒ Object
79
80
81
|
# File 'lib/aws_sam_yarn_builder/template.rb', line 79
def function_globals
FunctionGlobals.new(document["Globals"]["Function"])
end
|
#function_resource_by_logical_id(logical_id) ⇒ Object
73
74
75
76
77
|
# File 'lib/aws_sam_yarn_builder/template.rb', line 73
def function_resource_by_logical_id(logical_id)
raw_function_resource = raw_function_resources.detect { |name, options| name == logical_id }
FunctionResource.new(raw_function_resource.first, raw_function_resource.last["Properties"])
end
|
#function_resources ⇒ Object
69
70
71
|
# File 'lib/aws_sam_yarn_builder/template.rb', line 69
def function_resources
@function_resources ||= raw_function_resources.map { |name, options| FunctionResource.new(name, options["Properties"]) }
end
|
65
66
67
|
# File 'lib/aws_sam_yarn_builder/template.rb', line 65
def transform
document["Transform"]
end
|
#write_to_output(output, source_directory, unified = false) ⇒ Object
59
60
61
62
63
|
# File 'lib/aws_sam_yarn_builder/template.rb', line 59
def write_to_output(output, source_directory, unified = false)
File.open(File.join(output, "template.yaml"), "w+") do |file|
file << transformed_contents(source_directory, unified)
end
end
|