--- !ruby/object:RI::ClassDescription 
attributes: 
- !ruby/object:RI::Attribute 
  comment: 
  name: padding
  rw: RW
class_methods: 
- !ruby/object:RI::MethodSummary 
  name: new
comment: 
- !ruby/struct:SM::Flow::P 
  body: This class is the main frontend of the library. Use it to read and write ID3 tag data of files.
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Example of use
- !ruby/struct:SM::Flow::VERB 
  body: "   tag = ID3Lib::Tag.new('shy_boy.mp3')\n\n   # Remove comments\n   tag.delete_if{ |frame| frame[:id] == :COMM }\n\n   # Set year\n   tag.year   #=&gt; 2000\n   tag.year = 2005\n\n   # Apply changes\n   tag.update!\n"
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Working with tags
- !ruby/struct:SM::Flow::P 
  body: You can use a ID3Lib::Tag object like an array. In fact, it is a subclass of Array. An ID3Lib::Tag contains frames which are stored as hashes, with field IDs as keys and field values as values. The frame IDs like TIT2 are the ones specified by the ID3 standard. If you don't know these IDs, you probably want to use the accessor methods described afterwards, which have a more natural naming.
- !ruby/struct:SM::Flow::VERB 
  body: "   tag.each do |frame|\n     p frame\n   end\n   #=&gt; {:id =&gt; :TIT2, :text =&gt; &quot;Shy Boy&quot;, :textenc =&gt; 0}\n   #=&gt; {:id =&gt; :TPE1, :text =&gt; &quot;Katie Melua&quot;, :textenc =&gt; 0}\n   #=&gt; {:id =&gt; :TALB, :text =&gt; &quot;Piece By Piece&quot;, :textenc =&gt; 0}\n   #=&gt; {:id =&gt; :TRCK, :text =&gt; &quot;1/12&quot;, :textenc =&gt; 0}\n   #=&gt; {:id =&gt; :TYER, :text =&gt; &quot;2005&quot;, :textenc =&gt; 0}\n   #=&gt; {:id =&gt; :TCON, :text =&gt; &quot;Jazz/Blues&quot;, :textenc =&gt; 0}\n"
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Get and set frames
- !ruby/struct:SM::Flow::P 
  body: There are a number of accessors for text frames like title, performer, album, track, year, comment and genre. Have a look at ID3Lib::Accessors for a complete list.
- !ruby/struct:SM::Flow::VERB 
  body: "   tag.title    #=&gt; &quot;Shy Boi&quot;\n\n   tag.title = 'Shy Boy'\n   tag.title    #=&gt; &quot;Shy Boy&quot;\n\n   tag.track    #=&gt; [1,12]\n   tag.year     #=&gt; 2005\n"
- !ruby/struct:SM::Flow::P 
  body: "You can always read and write the raw text if you want. You just have to use the &quot;manual access&quot;. It is generally encouraged to use the #frame_text method where possible, because the other two result in an exception when the frame isn't found."
- !ruby/struct:SM::Flow::VERB 
  body: "   tag.frame_text(:TRCK)                  #=&gt; &quot;1/12&quot;\n   tag.frame_text(:TLAN)                  #=&gt; nil\n\n   tag.frame(:TRCK)[:text]                #=&gt; &quot;1/12&quot;\n   # Raises an exception, because nil[:text] isn't possible:\n   tag.frame(:TLAN)[:text]\n\n   tag.find{ |f| f[:id] == :TRCK }[:text] #=&gt; &quot;1/12&quot;\n   # Also raises an exception:\n   tag.find{ |f| f[:id] == :TLAN }[:text]\n"
- !ruby/struct:SM::Flow::P 
  body: Because only text frames can be set with accessors, you have to add special frames by hand.
- !ruby/struct:SM::Flow::VERB 
  body: "   # Add two comments\n   tag &lt;&lt; {:id =&gt; :COMM, :text =&gt; 'chunky bacon'}\n   tag &lt;&lt; {:id =&gt; :COMM, :text =&gt; 'really.'}\n\n   # Add an attached picture\n   cover = {\n     :id          =&gt; :APIC,\n     :mimetype    =&gt; 'image/jpeg',\n     :picturetype =&gt; 3,\n     :description =&gt; 'A pretty picture',\n     :textenc     =&gt; 0,\n     :data        =&gt; File.read('cover.jpg')\n   }\n   tag &lt;&lt; cover\n"
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Get information about frames
- !ruby/struct:SM::Flow::P 
  body: In the last example we added an APIC frame. How can we know what data we have to store in the APIC hash?
- !ruby/struct:SM::Flow::VERB 
  body: "   ID3Lib::Info.frame(:APIC)[3]\n   #=&gt; [:textenc, :mimetype, :picturetype, :description, :data]\n"
- !ruby/struct:SM::Flow::P 
  body: We see, the last element of the info array obtained through ID3Lib::Info.frame is an array of field IDs needed by APIC.
- !ruby/struct:SM::Flow::P 
  body: Have a look at the ID3Lib::Info module for detailed information.
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Write changes to file
- !ruby/struct:SM::Flow::P 
  body: "When you've finished modifying a tag, don't forget to call #update! to write the modifications back to the file. You have to check the return value of update!, it returns nil on failure. This probably means that the file is not writeable or cannot be created."
- !ruby/struct:SM::Flow::VERB 
  body: "   tag.update!\n"
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Getting rid of a tag
- !ruby/struct:SM::Flow::P 
  body: "Use the #strip! method to completely remove a tag from a file."
- !ruby/struct:SM::Flow::VERB 
  body: "   tag.strip!\n"
constants: []

full_name: ID3Lib::Tag
includes: 
- !ruby/object:RI::IncludedModule 
  name: Accessors
instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: frame
- !ruby/object:RI::MethodSummary 
  name: frame_text
- !ruby/object:RI::MethodSummary 
  name: has_tag?
- !ruby/object:RI::MethodSummary 
  name: invalid_frames
- !ruby/object:RI::MethodSummary 
  name: remove_frame
- !ruby/object:RI::MethodSummary 
  name: set_frame_text
- !ruby/object:RI::MethodSummary 
  name: size
- !ruby/object:RI::MethodSummary 
  name: strip!
- !ruby/object:RI::MethodSummary 
  name: update!
name: Tag
superclass: Array
