Class: Hashify
- Inherits:
-
Object
- Object
- Hashify
- Defined in:
- lib/primus.rb
Overview
Takes a hash and returns string of reverse order odd keys
Class Method Summary collapse
Class Method Details
.call(hash) ⇒ Object
7 8 9 10 11 |
# File 'lib/primus.rb', line 7 def self.call(hash) raise 'This hash is empty' if hash.empty? array = hash.each_with_index.map { |(key), index| key.upcase if index.odd? }.compact array.sort.reverse.join('') end |