Class: UncleKryon::AlbumData

Inherits:
BaseData show all
Defined in:
lib/unclekryon/data/album_data.rb

Instance Attribute Summary collapse

Attributes inherited from BaseData

#updated_on

Instance Method Summary collapse

Methods inherited from BaseData

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

Constructor Details

#initializeAlbumData



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/unclekryon/data/album_data.rb', line 36

def initialize
  super()

  @date_begin = ''
  @date_end = ''
  @title = ''
  @locations = []
  @languages = []

  @url = ''
  @mirrors = {}

  @desc = ''

  @pics = {}
  @aums = {}
  @scrolls = {}
  @visions = {}

  @dump = []
end

Instance Attribute Details

#aumsObject

Returns the value of attribute aums.



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

def aums
  @aums
end

#date_beginObject

Returns the value of attribute date_begin.



18
19
20
# File 'lib/unclekryon/data/album_data.rb', line 18

def date_begin
  @date_begin
end

#date_endObject

Returns the value of attribute date_end.



19
20
21
# File 'lib/unclekryon/data/album_data.rb', line 19

def date_end
  @date_end
end

#descObject

Returns the value of attribute desc.



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

def desc
  @desc
end

#dumpObject

Returns the value of attribute dump.



34
35
36
# File 'lib/unclekryon/data/album_data.rb', line 34

def dump
  @dump
end

#languagesObject

Returns the value of attribute languages.



22
23
24
# File 'lib/unclekryon/data/album_data.rb', line 22

def languages
  @languages
end

#locationsObject

Returns the value of attribute locations.



21
22
23
# File 'lib/unclekryon/data/album_data.rb', line 21

def locations
  @locations
end

#mirrorsObject

Returns the value of attribute mirrors.



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

def mirrors
  @mirrors
end

#picsObject

Returns the value of attribute pics.



29
30
31
# File 'lib/unclekryon/data/album_data.rb', line 29

def pics
  @pics
end

#scrollsObject

Returns the value of attribute scrolls.



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

def scrolls
  @scrolls
end

#titleObject

Returns the value of attribute title.



20
21
22
# File 'lib/unclekryon/data/album_data.rb', line 20

def title
  @title
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end

#visionsObject

Returns the value of attribute visions.



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

def visions
  @visions
end

Instance Method Details

#==(other) ⇒ Object

Excludes @updated_on and @dump



98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/unclekryon/data/album_data.rb', line 98

def ==(other)
  return @date_begin == other.date_begin &&
         @date_end == other.date_end &&
         @title == other.title &&
         @locations == other.locations &&
         @languages == other.languages &&
         @url == other.url &&
         @mirrors == other.mirrors &&
         @desc == other.desc &&
         @pics == other.pics &&
         @aums == other.aums &&
         @scrolls == other.scrolls &&
         @visions == other.visions
end

#initialize_copy(original) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/unclekryon/data/album_data.rb', line 58

def initialize_copy(original)
  super(original)

  @date_begin = @date_begin.clone
  @date_end = @date_end.clone
  @title = @title.clone
  @locations = @locations.clone
  @languages = @languages.clone

  @url = @url.clone
  @mirrors = @mirrors.clone

  @desc = @desc.clone

  @pics = @pics.clone
  @aums = @aums.clone
  @scrolls = @scrolls.clone
  @visions = @visions.clone

  @dump = @dump.clone
end

#to_mini_sObject



113
114
115
# File 'lib/unclekryon/data/album_data.rb', line 113

def to_mini_s
  return to_s(true)
end

#to_s(mini = false) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/unclekryon/data/album_data.rb', line 117

def to_s(mini=false)
  s = ''
  s << ('%-10s=>%-10s' % [@date_begin,@date_end])
  s << (' | %60s' % [@title])
  s << (' | %25s' % [@locations.join(';')])
  s << (' | %10s' % [@languages.join(';')])

  s << "\n- #{@desc}" unless mini

  #s << (mini ? (' | pics:%3d'    % [@pics.length()]) :
  #     ("\n- Pics:\n  - " << @pics.join("\n  - ")))
  #s << (mini ? (' | aums:%3d'    % [@aums.length()]) :
  #     ("\n- Aums:\n  - " << @aums.join("\n  - ")))
  #s << (mini ? (' | scrolls:%3d' % [@scrolls.length()]) :
  #     ("\n- Scrolls:\n - " << @scrolls.join("\n  - ")))
  #s << (mini ? (' | visions:%3d' % [@visions.length()]) :
  #     ("\n- Visions:\n - " << @visions.join("\n  - ")))

  s << (mini ? (' | dump:%3d' % [@dump.length]) : ("\n- Dump:\n  - " << @dump.join("\n  - ")))
  return s
end

#update_if_not_empty!(album) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/unclekryon/data/album_data.rb', line 80

def update_if_not_empty!(album)
  @date_begin = album.date_begin unless Util.empty_s?(album.date_begin)
  @date_end = album.date_end unless Util.empty_s?(album.date_end)
  @title = album.title unless Util.empty_s?(album.title)
  @locations |= album.locations unless album.locations.nil?
  @languages |= album.languages unless album.languages.nil?

  @desc = album.desc unless Util.empty_s?(album.desc)

  @pics |= album.pics unless album.pics.nil?
  @aums |= album.aums unless album.aums.nil?
  @scrolls |= album.scrolls unless album.scrolls.nil?
  @visions |= album.visions unless album.visions.nil?

  @dump |= album.dump unless album.dump.nil?
end