Class: MTP::Association

Inherits:
Object
  • Object
show all
Defined in:
lib/mtp/association.rb

Direct Known Subclasses

GenericFolder

Defined Under Namespace

Classes: GenericFolder

Constant Summary collapse

ASSOCIATION_CODES =
{
  0x0000 => "Undefined", 0x0001 => "Generic Folder", 0x0002 => "Album", 0x0003 => "Time Sequence",
  0x0004 => "Horizontal Panoramic", 0x0005 => "Vertical Panoramic", 0x0006 => "2D Panoramic",
  0x0007 => "Ancillary Data"
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeObject

Returns the value of attribute code.



22
23
24
# File 'lib/mtp/association.rb', line 22

def code
  @code
end

Class Method Details

.load(code, desc) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mtp/association.rb', line 9

def self.load(code, desc)
  assoc = case code
          when 0x0001
            GenericFolder.load(desc)
          else
            Association.new
          end
  assoc.instance_eval do
    self.code = code
  end
  assoc
end

Instance Method Details

#descObject



27
28
29
# File 'lib/mtp/association.rb', line 27

def desc
  0x0000
end