Class: UncleKryon::PicData

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

Instance Attribute Summary collapse

Attributes inherited from BaseData

#updated_on

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

#initializePicData

Returns a new instance of PicData.



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/unclekryon/data/pic_data.rb', line 25

def initialize
  super()

  @name = ''
  @filename = ''

  @alt = ''
  @caption = ''

  @url = ''
  @mirrors = {}
end

Instance Attribute Details

#altObject

Returns the value of attribute alt.



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

def alt
  @alt
end

#captionObject

Returns the value of attribute caption.



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

def caption
  @caption
end

#filenameObject

Returns the value of attribute filename.



17
18
19
# File 'lib/unclekryon/data/pic_data.rb', line 17

def filename
  @filename
end

#mirrorsObject

Returns the value of attribute mirrors.



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

def mirrors
  @mirrors
end

#nameObject

Returns the value of attribute name.



16
17
18
# File 'lib/unclekryon/data/pic_data.rb', line 16

def name
  @name
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end

Instance Method Details

#==(other) ⇒ Object

Excludes @updated_on



39
40
41
42
43
44
45
46
# File 'lib/unclekryon/data/pic_data.rb', line 39

def ==(other)
  return @name == other.name &&
         @filename == other.filename &&
         @alt == other.alt &&
         @caption == other.caption &&
         @url == other.url &&
         @mirrors == other.mirrors
end

#to_sObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/unclekryon/data/pic_data.rb', line 48

def to_s
  s = ''.dup

  if @name.empty? || @name.strip.empty?
    s << ('%-100s' % [@url])
  else
    s << ('%-30s' % [@name])
    s << (' | %30s' % [@filename]) unless @name == @filename

    s << (' | %30s' % [@alt]) unless @name == @alt
    s << (' | %60s' % [@caption])
  end

  return s
end