Sha256: 478312bd020ed767c17c41fde6d2bd5dbdf45855019ede2dd1e1c35eaa1a124e
Contents?: true
Size: 713 Bytes
Versions: 48
Compression:
Stored size: 713 Bytes
Contents
module ScoutApm module AttributeArranger # pass in an array of symbols to return as hash keys # if the symbol doesn't match the name of the method, pass an array: [:key, :method_name] def self.call(subject, attributes_list) attributes_list.inject({}) do |attribute_hash, attribute| case attribute when Array attribute_hash[attribute[0]] = subject.send(attribute[1]) when :bucket attribute_hash[attribute] = subject.bucket_type when :name attribute_hash[attribute] = subject.bucket_name when Symbol attribute_hash[attribute] = subject.send(attribute) end attribute_hash end end end end
Version data entries
48 entries across 48 versions & 1 rubygems