Module: Enumerable
- Included in:
- Nagios::Base, Puppet::Bindings, Puppet::Graph::RbTreeMap, Puppet::ModuleTool::Checksums, Puppet::Parser::AST::Branch, Puppet::Pops::Types::IntegerRangeIterator, Puppet::Pops::Types::PStructType, Puppet::Pops::Types::PTupleType, Puppet::Pops::Types::PVariantType, Puppet::Pops::Types::StepIterator, Puppet::Provider::Package::Windows::Package, Puppet::Resource, Puppet::Settings, Puppet::Type, Puppet::Type, Puppet::Util::FileWatcher, Puppet::Util::Windows::ADSI::Group, Puppet::Util::Windows::ADSI::User, Puppet::Util::Windows::AccessControlList, Puppet::Util::Windows::RootCerts
- Defined in:
- lib/puppet/util/monkey_patches.rb
Instance Method Summary collapse
Instance Method Details
#uniq ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/puppet/util/monkey_patches.rb', line 88 def uniq result = [] uniq_map = {} if block_given? each do |value| key = yield value next if uniq_map.has_key?(key) uniq_map[key] = true result << value end else each do |value| next if uniq_map.has_key?(value) uniq_map[value] = true result << value end end result end |