Class: Net::DAAP::DMAP

Inherits:
Object
  • Object
show all
Defined in:
lib/net/daap/dmap.rb

Overview

structures.

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ DMAP

Returns a new instance of DMAP.



6
7
8
9
10
11
# File 'lib/net/daap/dmap.rb', line 6

def initialize(args)
  @daap           = args[:daap]
  @big_endian     = "Ruby".unpack("i")[0] != 2036495698 ? true : false
  @type_to_unpack = find_type
  update_content_codes
end

Instance Method Details

#find(data, to_find) ⇒ Object



13
14
15
# File 'lib/net/daap/dmap.rb', line 13

def find(data, to_find)
  seek(unpack(data), to_find)
end

#flat_list(data) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/net/daap/dmap.rb', line 17

def flat_list(data)
  struct = unpack(data)
  hash_list = Hash.new
  flat_list = flat_list_traverse(struct)
  0.step(flat_list.length - 1, 2) do |i|
    hash_list[flat_list[i]] = flat_list[i + 1]
  end
  hash_list
end