Answers if this resource is tagged with at least one of the tags given in downcased string form.
The method is a faster variant of the tagged? method that does no conversion of its arguments.
@param tag_array [Array] array of tags to look for @return [Boolean] true if this instance is tagged with at least one of the provided tags
# File lib/puppet/util/tagging.rb, line 47 def raw_tagged?(tag_array) my_tags = self.tags !tag_array.index { |t| my_tags.include?(t) }.nil? end
Add a tag to the current tag set. When a tag set is used for a scope, these tags will be added to all of the objects contained in this scope when the objects are finished.
# File lib/puppet/util/tagging.rb, line 10 def tag(*ary) @tags ||= new_tags ary.flatten.each do |tag| name = tag.to_s.downcase if name =~ ValidTagRegex @tags << name if split_qualified_tags? name.split("::").each do |section| @tags << section end end else fail(Puppet::ParseError, "Invalid tag '#{name}'") end end end
Answers if this resource is tagged with at least one of the given tags.
The given tags are converted to downcased strings before the match is performed.
@param *tags [String] splat of tags to look for @return [Boolean] true if this instance is tagged with at least one of the provided tags
# File lib/puppet/util/tagging.rb, line 35 def tagged?(*tags) raw_tagged?(tags.collect {|t| t.to_s.downcase}) end