Class: ID3Tag::Frames::V2::FrameFabricator

Inherits:
Object
  • Object
show all
Defined in:
lib/id3tag/frames/v2/frame_fabricator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, content, flags, major_version_number) ⇒ FrameFabricator

Returns a new instance of FrameFabricator.



11
12
13
# File 'lib/id3tag/frames/v2/frame_fabricator.rb', line 11

def initialize(id, content, flags, major_version_number)
  @id, @content, @flags, @major_version_number = id, content, flags, major_version_number
end

Class Method Details

.fabricate(id, content, flags, major_version_number) ⇒ Object



6
7
8
# File 'lib/id3tag/frames/v2/frame_fabricator.rb', line 6

def fabricate(id, content, flags, major_version_number)
  new(id, content, flags, major_version_number).fabricate
end

Instance Method Details

#fabricateObject



15
16
17
# File 'lib/id3tag/frames/v2/frame_fabricator.rb', line 15

def fabricate
  frame_class.new(@id, @content, @flags, @major_version_number)
end

#frame_classObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/id3tag/frames/v2/frame_fabricator.rb', line 19

def frame_class
  case @id
  when /^(TCON|TCO)$/
    GenreFrame
  when /^TXX/
    UserTextFrame
  when /^T/
    TextFrame
  when /^(COM|COMM)$/
    CommentsFrame
  when /^(ULT|USLT)$/
    UnsychronizedTranscriptionFrame
  when /^UFID$/
    UniqueFileIdFrame
  when /^(IPL|IPLS)$/
    InvolvedPeopleListFrame
  when /^PRIV$/
    PrivateFrame
  else
    BasicFrame
  end
end