Sha256: 5be6321998fb0bae08757690dc289b11e9b37db4b7e752ad923def013c46b2c8
Contents?: true
Size: 447 Bytes
Versions: 1
Compression:
Stored size: 447 Bytes
Contents
# frozen_string_literal: true require 'primus/version' # Takes a hash and returns string of reverse order odd keys class Hashify 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 end # add rubo cop, frozen string, revise sort each with index, each_slice, # slice_each, call this without caiing .new
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
primus_lapus-0.1.3 | lib/primus.rb |