Class: ID3::GenericTag

Inherits:
RestrictedOrderedHash show all
Defined in:
lib/id3/generic_tag.rb

Overview

BUG (4) : When an ID3frame is assigned a value, e.g. a String, then the Hash just stores the value right now.

Whereas when you read the ID3v2 tag, the object for the frame is ID3::Frame

Direct Known Subclasses

Tag1, Tag2

Instance Attribute Summary collapse

Attributes inherited from RestrictedOrderedHash

#locked

Instance Method Summary collapse

Methods inherited from RestrictedOrderedHash

#delete, #initialize, #lock, #old_delete, #old_store

Constructor Details

This class inherits a constructor from RestrictedOrderedHash

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw


19
20
21
# File 'lib/id3/generic_tag.rb', line 19

def raw
  @raw
end

#versionObject

Returns the value of attribute version


18
19
20
# File 'lib/id3/generic_tag.rb', line 18

def version
  @version
end

Instance Method Details

#[]=(key, val) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/id3/generic_tag.rb', line 29

def []=(key,val)
  if @version == ""
    raise ArgumentError, "undefined version of ID3-tag! - set version before accessing components!\n" 
  else
    if ID3::SUPPORTED_SYMBOLS[@version].keys.include?(key)
      old_set(key,val)
    else 
      # exception
      raise ArgumentError, "Incorrect ID3-field \"#{key}\" for ID3 version #{@version}\n" +
        "               valid ID3-fields are: " + SUPPORTED_SYMBOLS[@version].keys.join(",") +"\n"
    end
  end
end