Sha256: cee11070a403e7697bff1bd4e84feabe081761e083e806a71487789a23c07ab3
Contents?: true
Size: 446 Bytes
Versions: 1
Compression:
Stored size: 446 Bytes
Contents
# frozen_string_literal: true require 'primus/version' # Takes a hash and returns string of reverse order odd keys class Primus 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.2 | lib/primus.rb |