Sha256: f6f9f637eee051e13ba3decf22133e1c8a9e3b854eb83df7c30a5aa64aba3134
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module DspBlueprintParser # Data Sections # # Given a raw DSP Blueprint sting this returns readability # usable data on the string class DataSections # @param str_blueprint [String] def initialize(str_blueprint) @str_blueprint = str_blueprint @first_quote_loc = @str_blueprint.index('"') @second_quote_loc = @str_blueprint[(@first_quote_loc + 1)..].index('"') + @first_quote_loc end # @return [Array<String>] def header_segments @header_segments ||= @str_blueprint[10..@first_quote_loc - 1].split(',') end def hashed_string @str_blueprint[..@second_quote_loc] end def hash @str_blueprint[@second_quote_loc + 2..-1] end # @return [Array<Integer>] array of bytes, 0..255 def decompressed_body @decompressed_body ||= @str_blueprint[@first_quote_loc + 1..@second_quote_loc] .then(&Base64.method(:decode64)) .then(&StringIO.method(:new)) .then(&Zlib::GzipReader.method(:new)) .each_byte .to_a end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dsp_blueprint_parser-0.1.3 | lib/dsp_blueprint_parser/data_sections.rb |
dsp_blueprint_parser-0.1.2 | lib/dsp_blueprint_parser/data_sections.rb |