Navigation Menu

Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

Commit

Permalink
Removing a monkey
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny committed Nov 1, 2008
1 parent a0abac5 commit 9f66104
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions loved.rb
Expand Up @@ -4,15 +4,6 @@
require 'yaml'
require 'iconv'

class Hash
def keep(keys)
inject({}) do |hash, (key, value)|
hash[key] = value if keys.include?(key)
hash
end
end
end

class MPD
class Song
def to_s
Expand Down Expand Up @@ -53,8 +44,8 @@ def love_it!(song, tags=[])

return if loved?(song)

auto_tags = song.keep(@@auto_tags).values
song.tags = tags.push(*auto_tags).uniq
auto_tags = @@auto_tags.map { |key| song[key] }.chomp
song.tags = (tags + auto_tags).uniq

write_to_database(song.tags, song.file)

Expand Down

0 comments on commit 9f66104

Please sign in to comment.