Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/log2counter/core_ext/sort_by_ip_or_host.rb
Instance Method Summary collapse
-
#sort_by_ip_or_host ⇒ Object
Sort IP addresses numerically by net part, and host names just as usual.
Instance Method Details
#sort_by_ip_or_host ⇒ Object
Sort IP addresses numerically by net part, and host names just as usual.
35 36 37 38 39 40 41 |
# File 'lib/log2counter/core_ext/sort_by_ip_or_host.rb', line 35 def sort_by_ip_or_host sort_by { |key, _| key ? key.split('.').map { |part| part =~ /\A\d+\z/ ? part.to_i : part } : [] } end |