Class: RTV::Presenter

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

Constant Summary collapse

Source_charset =
'ISO-8859-1'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(charset = 'UTF-8') ⇒ Presenter

Returns a new instance of Presenter.



193
194
195
# File 'lib/rtv.rb', line 193

def initialize charset = 'UTF-8'
  @target_charset = charset
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



191
192
193
# File 'lib/rtv.rb', line 191

def config
  @config
end

Instance Method Details

#show(programm) ⇒ Object



218
219
220
# File 'lib/rtv.rb', line 218

def show programm
  puts to_s(programm)
end

#to_s(program) ⇒ Object



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/rtv.rb', line 197

def to_s program
  returnstring = ""
  senderlimit = @config[:senderlimit]
  @config[:senderfilter].each do |channel|
    lastshow = nil
    tmp = program.channel[channel]

    unless tmp.nil?
      tmp.each do  |show|
        return if (@config[:senderlimit] -= 1) < 1

        returnstring << Iconv.iconv(@target_charset, Source_charset, show.to_s(lastshow)).to_s << "\n"

        break if @config[:eine_pro_sender]
        lastshow = show
      end
    end
  end
  returnstring
end