Class: Idiomag::Artist
- Inherits:
-
Object
show all
- Defined in:
- lib/idiomag/artist.rb
Instance Method Summary
collapse
Constructor Details
#initialize(artist) ⇒ Artist
Returns a new instance of Artist.
4
5
6
7
|
# File 'lib/idiomag/artist.rb', line 4
def initialize(artist)
raise ArgumentError if artist.blank?
@artist = artist
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/idiomag/artist.rb', line 39
def method_missing(method, *args)
case method
when :name
@artist
when :links
get_info if @links.nil?
@links
when :related
get_info if @related.nil?
@related
when :tags
get_tags if @tags.nil?
@tags
when :articles
get_articles if @articles.nil?
@articles
when :photos
get_photos if @photos.nil?
@photos
when :videos
get_videos if @videos.nil?
@videos
when :playlist, :tracks
get_playlist if @playlist.nil?
@playlist
else
super
end
end
|
Instance Method Details
#get(*args) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/idiomag/artist.rb', line 9
def get(*args)
args.each do |action|
case action
when :info
get_info
when :tags
get_tags
when :articles
get_articles
when :photos
get_photos
when :videos
get_videos
when :playlist, :tracks
get_playlist
else
raise ArgumentError
end
end
end
|
#respond_to?(method) ⇒ Boolean
30
31
32
33
34
35
36
37
|
# File 'lib/idiomag/artist.rb', line 30
def respond_to?(method)
case method
when :links,:related,:tags,:articles,:photos,:videos,:playlist,:tracks,:name
true
else
super
end
end
|