Class: RMD::Factory::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rmd/factory/base.rb

Direct Known Subclasses

NCT, Zing

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

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

#buildObject



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