Class: Lono::Template::Strategy::Dsl::Builder::Section::Output
- Defined in:
- lib/lono/template/strategy/dsl/builder/section/output.rb
Constant Summary
Constants included from Fn
Instance Method Summary collapse
-
#standarize(definition) ⇒ Object
Value is the only required property: amzn.to/2xbhmk3.
- #template ⇒ Object
Methods inherited from Base
Methods included from Lono::Template::Strategy::Dsl::Builder::Stringify
Methods included from Helpers::TagsHelper
Methods included from Helpers::S3Helper
Methods included from Helpers::LookupHelper
Methods included from AwsServices
#cfn, #ec2, #iam, #s3, #s3_presigner, #s3_resource, #sts
Methods included from AwsServices::Helper
#rollback_complete?, #testing_update?
Methods included from AwsServices::StackSet
#find_stack_set, #stack_set_exists?
Methods included from AwsServices::Stack
Methods included from Helpers::FileHelper
#content, #render_file, #render_path, #user_data, #user_data_script
Methods included from Helpers::CoreHelper
Methods included from Fn
#conditional_ref, define_methods, #fn, #fn_id, #get_att, #get_azs, included, #join, #ref, #sub
Constructor Details
This class inherits a constructor from Lono::Template::Strategy::Dsl::Builder::Section::Base
Instance Method Details
#standarize(definition) ⇒ Object
Value is the only required property: amzn.to/2xbhmk3
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/lono/template/strategy/dsl/builder/section/output.rb', line 12 def standarize(definition) first, second, _ = definition if definition.size == 1 && first.is_a?(Hash) # long form first # pass through elsif definition.size == 2 && second.is_a?(Hash) # medium form if second.key?(:value) || second.key?("Value") logical_id, properties = first, second else logical_id = first properties = {Value: second} end { logical_id => properties } elsif definition.size == 2 && (second.is_a?(String) || second.nil?) # short form logical_id = first properties = second.is_a?(String) ? { Value: second } : {} { logical_id => properties } elsif definition.size == 1 logical_id = first.to_s properties = { Value: ref(logical_id) } { logical_id => properties } else # I dont know what form raise "Invalid form provided. definition #{definition.inspect}" end end |
#template ⇒ Object
7 8 9 |
# File 'lib/lono/template/strategy/dsl/builder/section/output.rb', line 7 def template camelize(standarize(@definition)) end |