Class: Flacky::Tagger
- Inherits:
-
Object
- Object
- Flacky::Tagger
- Defined in:
- lib/flacky/tagger.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(flac_file) ⇒ Tagger
constructor
A new instance of Tagger.
- #tag(name, value) ⇒ Object
- #update! ⇒ Object
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..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 |