Class: Puppet::ResourceApi::MonkeyHash
- Inherits:
-
Hash
- Object
- Hash
- Puppet::ResourceApi::MonkeyHash
- Defined in:
- lib/puppet/resource_api/glue.rb
Overview
this hash allows key-value based ordering comparisons between instances of this and instances of this and other classes this is required for ‘lib/puppet/indirector/resource/ral.rb`’s ‘search` method which expects all titles to be comparable
Instance Method Summary collapse
Instance Method Details
#<=>(other) ⇒ Object
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/puppet/resource_api/glue.rb', line 71 def <=>(other) result = self.class.name <=> other.class.name if result.zero? result = keys.sort <=> other.keys.sort end if result.zero? result = keys.sort.map { |k| self[k] } <=> other.keys.sort.map { |k| other[k] } end result end |