Class: Flacky::Tagger

Inherits:
Object
  • Object
show all
Defined in:
lib/flacky/tagger.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flac_file) ⇒ Tagger

Returns a new instance of Tagger.



13
14
15
16
# File 'lib/flacky/tagger.rb', line 13

def initialize(flac_file)
  @flac_file = flac_file
  @flac = FlacInfo.new(@flac_file)
end

Class Method Details

.update(flac_file, &block) ⇒ Object



7
8
9
10
11
# File 'lib/flacky/tagger.rb', line 7

def self.update(flac_file, &block)
  instance = self.new(flac_file)
  instance.instance_eval(&block)
  instance.update!
end

Instance Method Details

#tag(name, value) ⇒ Object



18
19
20
21
# File 'lib/flacky/tagger.rb', line 18

def tag(name, value)
  @flac.comment_del(name) if @flac.tags.keys.include?(name)
  @flac.comment_add("#{name}=#{value}")
end

#update!Object



23
24
25
# File 'lib/flacky/tagger.rb', line 23

def update!()
  @flac.update!
end