Sha256: f6726fe59b5011710c8d4b92c5d3446f3ebe7730fe0b37309d782a5083b64f29
Contents?: true
Size: 701 Bytes
Versions: 1
Compression:
Stored size: 701 Bytes
Contents
module DMAPParser # The Tag class class Tag < Struct.new(:type, :value) def initialize(type, value) unless type.is_a? TagDefinition type = TagDefinition[type] || TagDefinition.new(type, :unknown, "unknown (#{length})") end super end def to_s "#<#{self.class.name} #{type}>" end def inspect(level = 0) "#{' ' * level}#{type}: #{value}" end def to_dmap value = convert_value(self.value) length = [value.length].pack('N') (type.tag.to_s + length + value).force_encoding(Encoding::BINARY) end private def convert_value(value) Converter.encode(type.type, value) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dmapparser-0.1.0 | lib/dmapparser/tag.rb |