Class: TagLib::AudioTag

Inherits:
Data
  • Object
show all
Defined in:
lib/taglib_simple/audio_tag.rb

Overview

Represents a normalised subset of tags

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#albumString (readonly)

Returns The album name.

Returns:

  • (String)

    The album name



# File 'lib/taglib_simple/audio_tag.rb', line 15

#artistString (readonly)

Returns The artist name.

Returns:

  • (String)

    The artist name



# File 'lib/taglib_simple/audio_tag.rb', line 12

#genreString (readonly)

Returns The genre of the track.

Returns:

  • (String)

    The genre of the track



# File 'lib/taglib_simple/audio_tag.rb', line 18

#titleString (readonly)

Returns The title of the track.

Returns:

  • (String)

    The title of the track



# File 'lib/taglib_simple/audio_tag.rb', line 9

#trackInteger (readonly)

Returns The track number.

Returns:

  • (Integer)

    The track number



# File 'lib/taglib_simple/audio_tag.rb', line 24

#yearInteger (readonly)

Returns The release year.

Returns:

  • (Integer)

    The release year



# File 'lib/taglib_simple/audio_tag.rb', line 21

Class Method Details

.read(filename) ⇒ AudioTag

Parameters:

  • filename (String|:to_path|IO)

Returns:



33
34
35
# File 'lib/taglib_simple/audio_tag.rb', line 33

def read(filename)
  MediaFile.open(filename, all: false, tag: true, &:tag)
end

Instance Method Details

#to_hHash<Symbol, <String,Integer>>

Returns the tag values as a hash, excluding entries with nil values.

Returns:

  • (Hash<Symbol, <String,Integer>>)

    the tag values as a hash, excluding entries with nil values



62
63
64
65
# File 'lib/taglib_simple/audio_tag.rb', line 62

def to_h
  # do not expose nil entries
  super.compact
end