Class: RMD::Factory::Base
- Inherits:
-
Object
- Object
- RMD::Factory::Base
- Defined in:
- lib/rmd/factory/base.rb
Instance Attribute Summary collapse
-
#link ⇒ Object
readonly
Returns the value of attribute link.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(link) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(link) ⇒ Base
Returns a new instance of Base.
8 9 10 |
# File 'lib/rmd/factory/base.rb', line 8 def initialize(link) @link = link end |
Instance Attribute Details
#link ⇒ Object (readonly)
Returns the value of attribute link.
6 7 8 |
# File 'lib/rmd/factory/base.rb', line 6 def link @link end |
Class Method Details
.build(link) ⇒ Object
23 24 25 |
# File 'lib/rmd/factory/base.rb', line 23 def self.build(link) new(link).build end |
Instance Method Details
#build ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# 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 |