Class: RTV::Show

Inherits:
Object
  • Object
show all
Defined in:
lib/rtv.rb

Constant Summary collapse

Filler =
"\t"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#channelObject

Returns the value of attribute channel.



67
68
69
# File 'lib/rtv.rb', line 67

def channel
  @channel
end

#dateObject

Returns the value of attribute date.



67
68
69
# File 'lib/rtv.rb', line 67

def date
  @date
end

#descObject

Returns the value of attribute desc.



67
68
69
# File 'lib/rtv.rb', line 67

def desc
  @desc
end

#nameObject

Returns the value of attribute name.



67
68
69
# File 'lib/rtv.rb', line 67

def name
  @name
end

#optionsObject

Returns the value of attribute options.



67
68
69
# File 'lib/rtv.rb', line 67

def options
  @options
end

#showviewObject

Returns the value of attribute showview.



67
68
69
# File 'lib/rtv.rb', line 67

def showview
  @showview
end

#timeObject

Returns the value of attribute time.



67
68
69
# File 'lib/rtv.rb', line 67

def time
  @time
end

Instance Method Details

#to_aObject



84
85
86
87
88
# File 'lib/rtv.rb', line 84

def to_a
  tmp = [@channel, @date, @time, @name]
  tmp << @desc if @options[:desc]
  tmp
end

#to_s(*lastshow) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/rtv.rb', line 71

def to_s *lastshow
  if @options[:redundanz]
    self.to_a.compact.join(Filler)
  else
    lastshow = if lastshow.first.nil?
                 [()] * to_a.size
               else
                 lastshow.first
               end
    self.to_a.zip(lastshow.to_a).map{|x,y| (x == y) ? (' ' * x.to_s.size) : x}.reject{|x| x.empty?}.join(Filler)
  end
end