Module: AwsCftTools::TemplateSet::ArrayMethods
- Included in:
- AwsCftTools::TemplateSet
- Defined in:
- lib/aws_cft_tools/template_set/array_methods.rb
Overview
Array methods that need to be overridden to work well with template sets.
Instance Method Summary collapse
-
#+(other) ⇒ AwsCftTools::TemplateSet
create a new template set holding templates in either set without duplicates.
-
#-(other) ⇒ AwsCftTools::TemplateSet
create a new template set holding templates in the first set not in the second.
- #select {|AwsCftTools::Template| ... } ⇒ AwsCftTools::TemplateSet
-
#|(other) ⇒ AwsCftTools::TemplateSet
create a new template set holding templates in either set without duplicates.
Instance Method Details
#+(other) ⇒ AwsCftTools::TemplateSet
create a new template set holding templates in either set without duplicates
Note that this is identical to ‘|`.
17 18 19 20 21 |
# File 'lib/aws_cft_tools/template_set/array_methods.rb', line 17 def +(other) self.class.new(super(other).uniq(&:name)).tap do |union| union.known_exports = @known_exports end end |
#-(other) ⇒ AwsCftTools::TemplateSet
create a new template set holding templates in the first set not in the second
39 40 41 42 43 44 |
# File 'lib/aws_cft_tools/template_set/array_methods.rb', line 39 def -(other) forbidden_names = other.map(&:name) clone.replace_list( reject { |template| forbidden_names.include?(template.name) } ) end |
#select {|AwsCftTools::Template| ... } ⇒ AwsCftTools::TemplateSet
50 51 52 53 |
# File 'lib/aws_cft_tools/template_set/array_methods.rb', line 50 def select return unless block_given? clone.replace_list(super) end |
#|(other) ⇒ AwsCftTools::TemplateSet
create a new template set holding templates in either set without duplicates
29 30 31 |
# File 'lib/aws_cft_tools/template_set/array_methods.rb', line 29 def |(other) self + other end |