Class: Puppet::Util::MultiMatch
- Defined in:
- lib/puppet/util/multi_match.rb
Defined Under Namespace
Classes: MatchNotNil
Constant Summary collapse
- NOT_NIL =
MatchNotNil.new().freeze
- TUPLE =
MultiMatch.new(NOT_NIL, NOT_NIL).freeze
- TRIPLE =
MultiMatch.new(NOT_NIL, NOT_NIL, NOT_NIL).freeze
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #===(other) ⇒ Object
-
#initialize(*values) ⇒ MultiMatch
constructor
A new instance of MultiMatch.
Constructor Details
#initialize(*values) ⇒ MultiMatch
Returns a new instance of MultiMatch.
21 22 23 |
# File 'lib/puppet/util/multi_match.rb', line 21 def initialize(*values) @values = values end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
19 20 21 |
# File 'lib/puppet/util/multi_match.rb', line 19 def values @values end |
Instance Method Details
#===(other) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/puppet/util/multi_match.rb', line 25 def ===(other) lv = @values # local var is faster than instance var case other when MultiMatch return false unless other.values.size == values.size other.values.each_with_index {|v, i| return false unless lv[i] === v || v === lv[i]} when Array return false unless other.size == values.size other.each_with_index {|v, i| return false unless lv[i] === v || v === lv[i]} else false end true end |