class RMD::Factory::Base
Attributes
link[R]
Public Class Methods
build(link)
click to toggle source
# File lib/rmd/factory/base.rb, line 23 def self.build(link) new(link).build end
new(link)
click to toggle source
# File lib/rmd/factory/base.rb, line 8 def initialize(link) @link = link end
Public Instance Methods
build()
click to toggle source
# File lib/rmd/factory/base.rb, line 12 def build case link when song_regex RMD::SongPlaylistAdapter.new(base_class::Song.new(link)) when playlist_regex base_class::Playlist.new(link) else raise 'Your url is not valid. Please check again.' end end
Private Instance Methods
base_class()
click to toggle source
# File lib/rmd/factory/base.rb, line 34 def base_class; end
playlist_regex()
click to toggle source
# File lib/rmd/factory/base.rb, line 33 def playlist_regex; end
song_regex()
click to toggle source
# File lib/rmd/factory/base.rb, line 29 def song_regex /bai-hat/ end