lib/kagu/playlists.rb in kagu-0.2.0 vs lib/kagu/playlists.rb in kagu-0.2.1
- old
+ new
@@ -9,11 +9,15 @@
def initialize(library)
raise ArgumentError.new("#{self.class}#library must be a library, #{library.inspect} given") unless library.is_a?(Library)
@library = library
end
+ def build(attributes = {})
+ Playlist.new(attributes)
+ end
+
def create(attributes = {})
- Playlist.new(attributes).save
+ build(attributes).tap(&:save)
end
def each(&block)
return unless block_given?
tracks = {}.tap do |tracks|