Class: Tagomatic::InfoUpdater

Inherits:
Object
  • Object
show all
Defined in:
lib/tagomatic/info_updater.rb

Instance Method Summary collapse

Constructor Details

#initialize(mp3info) ⇒ InfoUpdater

Returns a new instance of InfoUpdater.



5
6
7
8
# File 'lib/tagomatic/info_updater.rb', line 5

def initialize(mp3info)
  @info = mp3info
  @updates = {}
end

Instance Method Details

#album=(value) ⇒ Object



22
23
24
# File 'lib/tagomatic/info_updater.rb', line 22

def album=(value)
  update :album, value
end

#applyObject



10
11
12
# File 'lib/tagomatic/info_updater.rb', line 10

def apply
  @updates.each { |tag, value| write(tag, value) }
end

#artist=(value) ⇒ Object



26
27
28
# File 'lib/tagomatic/info_updater.rb', line 26

def artist=(value)
  update :artist, value
end

#dirty?Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
# File 'lib/tagomatic/info_updater.rb', line 14

def dirty?
  @updates.each do |tag, value|
    current_value = read(tag).to_s
    return true if current_value != value.to_s
  end
  false
end

#genre_s=(value) ⇒ Object



30
31
32
# File 'lib/tagomatic/info_updater.rb', line 30

def genre_s=(value)
  update :genre_s, value
end

#title=(value) ⇒ Object



34
35
36
# File 'lib/tagomatic/info_updater.rb', line 34

def title=(value)
  update :title, value
end

#tracknum=(value) ⇒ Object



38
39
40
# File 'lib/tagomatic/info_updater.rb', line 38

def tracknum=(value)
  update :tracknum, value
end

#year=(value) ⇒ Object



42
43
44
# File 'lib/tagomatic/info_updater.rb', line 42

def year=(value)
  update :year, value
end