Class: Rutaci::TaglibSource

Inherits:
Source
  • Object
show all
Defined in:
lib/rutaci/taglib_source.rb

Overview

This class collects the taginfo from various sources.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Source

factory

Constructor Details

#initialize(filename, options) ⇒ TaglibSource

Returns a new instance of TaglibSource.

Raises:

  • (ArgumentError)


24
25
26
27
28
# File 'lib/rutaci/taglib_source.rb', line 24

def initialize(filename, options)
  raise ArgumentError, "options.fields need to be an array" unless options.fields.class == Array
  @tagfile = TagFile::File.new filename
  @info = self.get_fields options.fields
end

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



23
24
25
# File 'lib/rutaci/taglib_source.rb', line 23

def info
  @info
end

Instance Method Details

#get_fields(fieldlist) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/rutaci/taglib_source.rb', line 30

def get_fields(fieldlist)
  info = Hash.new
  fieldlist.each do |field|
    info[field] = @tagfile.send field
  end
  return info
end