Class: EyeTV::Channel

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

Overview

This is the class channel of EyeTv You can (des)activate an channel

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(chan_ref) ⇒ Channel

Returns a new instance of Channel.



8
9
10
11
# File 'lib/channel.rb', line 8

def initialize(chan_ref)
  raise "must no nil object" if(not chan_ref)        
  @chan_ref = chan_ref
end

Instance Attribute Details

#channel_numberObject

Returns the value of attribute channel_number.



6
7
8
# File 'lib/channel.rb', line 6

def channel_number
  @channel_number
end

Instance Method Details

#deleteObject



46
47
48
# File 'lib/channel.rb', line 46

def delete
  @chan_ref.delete
end

#enabled=(value) ⇒ Object

return true if action is possible



30
31
32
33
34
35
36
37
# File 'lib/channel.rb', line 30

def enabled=(value)
  if @chan_ref && value !=nil
    @chan_ref.enabled.set(value)
    true
  else
    false
  end      
end

#enabled?Boolean

Returns:

  • (Boolean)


39
40
41
42
43
44
# File 'lib/channel.rb', line 39

def enabled?
  if @chan_ref
    @enabled = @chan_ref.enabled.get
  end
  @enabled
end

#nameObject



13
14
15
# File 'lib/channel.rb', line 13

def name
  @chan_ref.name.get
end

#name=(new_name) ⇒ Object



17
18
19
# File 'lib/channel.rb', line 17

def name=(new_name)
  @chan_ref.name.set(new_name)
end

#to_sObject



50
51
52
# File 'lib/channel.rb', line 50

def to_s
  self.channel_number().to_s.concat(" ").concat(self.name()).concat(" ").concat(self.enabled?.to_s)
end