Class: ID3Tag::Frames::V2::GenreFrame::GenreParser

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

Direct Known Subclasses

GenreParser24, GenreParserPre24

Constant Summary collapse

NUMERIC =
/\A\d+\z/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(genre_string) ⇒ GenreParser

Returns a new instance of GenreParser.



9
10
11
# File 'lib/id3tag/frames/v2/genre_frame/genre_parser.rb', line 9

def initialize(genre_string)
  @genre_string = genre_string
end

Instance Attribute Details

#genre_stringObject (readonly)

Returns the value of attribute genre_string.



7
8
9
# File 'lib/id3tag/frames/v2/genre_frame/genre_parser.rb', line 7

def genre_string
  @genre_string
end

Instance Method Details

#expand_abbreviation(abbreviation) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/id3tag/frames/v2/genre_frame/genre_parser.rb', line 13

def expand_abbreviation(abbreviation)
  case abbreviation
  when 'CR'
    'Cover'
  when 'RX'
    'Remix'
  else
    if abbreviation =~ NUMERIC
      Util::GenreNames.find_by_id(abbreviation.to_i)
    else
      abbreviation
    end
  end
end

#genresObject



28
29
30
# File 'lib/id3tag/frames/v2/genre_frame/genre_parser.rb', line 28

def genres
  raise "#genres is not implemented for class #{self.class}"
end