Class: UncleKryon::ArtistData

Inherits:
BaseData
  • Object
show all
Defined in:
lib/unclekryon/data/artist_data.rb

Constant Summary collapse

ID =
'Artist'

Instance Attribute Summary collapse

Attributes inherited from BaseData

#updated_on

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseData

#initialize_copy, #max_updated_on, max_updated_on, #max_updated_on_s, max_updated_on_s, #update

Constructor Details

#initializeArtistData

Returns a new instance of ArtistData.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/unclekryon/data/artist_data.rb', line 42

def initialize
  super()

  @updated_releases_on = ''
  @updated_albums_on = ''
  @updated_aums_on = ''
  @updated_scrolls_on = ''
  @updated_visions_on = ''
  @updated_pics_on = ''

  @id = ''
  @name = ''
  @long_name = ''
  @desc = ''

  @url = ''
  @mirrors = {}

  @facebook = SocialData.new
  @twitter = SocialData.new
  @youtube = SocialData.new
end

Instance Attribute Details

#descObject

Returns the value of attribute desc.



33
34
35
# File 'lib/unclekryon/data/artist_data.rb', line 33

def desc
  @desc
end

#facebookObject

Returns the value of attribute facebook.



38
39
40
# File 'lib/unclekryon/data/artist_data.rb', line 38

def facebook
  @facebook
end

#idObject

Returns the value of attribute id.



30
31
32
# File 'lib/unclekryon/data/artist_data.rb', line 30

def id
  @id
end

#long_nameObject

Returns the value of attribute long_name.



32
33
34
# File 'lib/unclekryon/data/artist_data.rb', line 32

def long_name
  @long_name
end

#mirrorsObject

Returns the value of attribute mirrors.



36
37
38
# File 'lib/unclekryon/data/artist_data.rb', line 36

def mirrors
  @mirrors
end

#nameObject

Returns the value of attribute name.



31
32
33
# File 'lib/unclekryon/data/artist_data.rb', line 31

def name
  @name
end

#twitterObject

Returns the value of attribute twitter.



39
40
41
# File 'lib/unclekryon/data/artist_data.rb', line 39

def twitter
  @twitter
end

#updated_albums_onObject

Returns the value of attribute updated_albums_on.



24
25
26
# File 'lib/unclekryon/data/artist_data.rb', line 24

def updated_albums_on
  @updated_albums_on
end

#updated_aums_onObject

Returns the value of attribute updated_aums_on.



25
26
27
# File 'lib/unclekryon/data/artist_data.rb', line 25

def updated_aums_on
  @updated_aums_on
end

#updated_pics_onObject

Returns the value of attribute updated_pics_on.



28
29
30
# File 'lib/unclekryon/data/artist_data.rb', line 28

def updated_pics_on
  @updated_pics_on
end

#updated_releases_onObject

Returns the value of attribute updated_releases_on.



23
24
25
# File 'lib/unclekryon/data/artist_data.rb', line 23

def updated_releases_on
  @updated_releases_on
end

#updated_scrolls_onObject

Returns the value of attribute updated_scrolls_on.



26
27
28
# File 'lib/unclekryon/data/artist_data.rb', line 26

def updated_scrolls_on
  @updated_scrolls_on
end

#updated_visions_onObject

Returns the value of attribute updated_visions_on.



27
28
29
# File 'lib/unclekryon/data/artist_data.rb', line 27

def updated_visions_on
  @updated_visions_on
end

#urlObject

Returns the value of attribute url.



35
36
37
# File 'lib/unclekryon/data/artist_data.rb', line 35

def url
  @url
end

#youtubeObject

Returns the value of attribute youtube.



40
41
42
# File 'lib/unclekryon/data/artist_data.rb', line 40

def youtube
  @youtube
end

Class Method Details

.load_file(filepath) ⇒ Object



65
66
67
68
69
# File 'lib/unclekryon/data/artist_data.rb', line 65

def self.load_file(filepath)
  y = YAML.load_file(filepath)
  artist = y[ID]
  return artist
end

Instance Method Details

#save_to_file(filepath, **options) ⇒ Object



71
72
73
74
75
76
77
78
79
# File 'lib/unclekryon/data/artist_data.rb', line 71

def save_to_file(filepath,**options)
  raise "Empty filepath: #{filepath}" if filepath.nil? || (filepath = filepath.strip).empty?

  Util.mk_dirs_from_filepath(filepath)
  File.open(filepath,'w') do |f|
    artist = {ID => self}
    YAML.dump(artist,f)
  end
end

#to_mini_sObject



81
82
83
# File 'lib/unclekryon/data/artist_data.rb', line 81

def to_mini_s
  return to_s(true)
end

#to_s(mini = false) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
# File 'lib/unclekryon/data/artist_data.rb', line 85

def to_s(mini=false)
  s = ''
  s << ('%-5s' % [@id])
  s << (' | %15s' % [@name])
  s << (' | %25s' % [@long_name])
  s << (' | %s' % [@desc])
  s << (' | fb: @%-20s' % [@facebook.username])
  s << (' | tw: @%-20s' % [@twitter.username])
  s << (' | yt: @%-35s' % [@youtube.username])
  return s
end