class MkStack::Section
A CloudFormation template section
Attributes
contents[RW]
limit[R]
name[R]
Public Class Methods
new(name, type, limit = nil)
click to toggle source
-
name: The section's name (Resources, Outputs, etc.)
-
type: The section's type (Hash or String)
-
limit: The AWS limit for this section, if any
# File lib/mkstack/section.rb, line 11 def initialize(name, type, limit = nil) @name = name @limit = limit @contents = type.new end
Public Instance Methods
exceeds_limit?()
click to toggle source
Check if the section exceeds the AWS limit
# File lib/mkstack/section.rb, line 30 def exceeds_limit?; @limit && length > @limit; end
length()
click to toggle source
Return the length of the section's contents
# File lib/mkstack/section.rb, line 27 def length; @contents.length; end
merge(contents)
click to toggle source
Merge or override a section snippet
# File lib/mkstack/section.rb, line 19 def merge(contents) raise TypeError.new("#{contents.class} != #{@contents.class}") if contents.class != @contents.class return @contents.merge!(contents) if @contents.respond_to?(:merge!) @contents = contents end