Method: NewRelic::Agent::Aws.convert_section
- Defined in:
- lib/new_relic/agent/aws.rb
permalink .convert_section(section) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/new_relic/agent/aws.rb', line 46 def self.convert_section(section) buffer = 0 section.each do |chunk| buffer = (buffer << 5) + chunk end chunk_count = (section.length * 5.0 / 8.0).floor if section.length < 8 buffer >>= (5 - (chunk_count * 8)) % 5 end decoded = [] chunk_count.times do |i| shift = 8 * (chunk_count - 1 - i) decoded << ((buffer >> shift) & 255).to_s(16) end decoded end |