Class: SimplePvr::Model::Recording

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_pvr/model/recording.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel, show_name, start_time, duration, programme = nil) ⇒ Recording

Returns a new instance of Recording.



6
7
8
9
10
11
12
# File 'lib/simple_pvr/model/recording.rb', line 6

def initialize(channel, show_name, start_time, duration, programme=nil)
  @channel = channel
  @show_name = show_name
  @start_time = start_time
  @duration = duration
  @programme = programme
end

Instance Attribute Details

#channelObject

Returns the value of attribute channel.



4
5
6
# File 'lib/simple_pvr/model/recording.rb', line 4

def channel
  @channel
end

#conflictingObject

Returns the value of attribute conflicting.



4
5
6
# File 'lib/simple_pvr/model/recording.rb', line 4

def conflicting
  @conflicting
end

#durationObject

Returns the value of attribute duration.



4
5
6
# File 'lib/simple_pvr/model/recording.rb', line 4

def duration
  @duration
end

#programmeObject

Returns the value of attribute programme.



4
5
6
# File 'lib/simple_pvr/model/recording.rb', line 4

def programme
  @programme
end

#show_nameObject

Returns the value of attribute show_name.



4
5
6
# File 'lib/simple_pvr/model/recording.rb', line 4

def show_name
  @show_name
end

#start_timeObject

Returns the value of attribute start_time.



4
5
6
# File 'lib/simple_pvr/model/recording.rb', line 4

def start_time
  @start_time
end

Instance Method Details

#==(other) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/simple_pvr/model/recording.rb', line 42

def ==(other)
  other != nil &&
  other.channel == @channel &&
  other.show_name == @show_name &&
  other.start_time == @start_time &&
  other.duration == @duration &&
  other.programme == @programme
end

#conflicting?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/simple_pvr/model/recording.rb', line 22

def conflicting?
  conflicting
end

#expired?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/simple_pvr/model/recording.rb', line 14

def expired?
  expired_at(Time.now)
end

#expired_at(time) ⇒ Object



18
19
20
# File 'lib/simple_pvr/model/recording.rb', line 18

def expired_at(time)
  end_time < time
end

#inspectObject



26
27
28
# File 'lib/simple_pvr/model/recording.rb', line 26

def inspect
  "'#{@show_name}' from '#{@channel.name}' at '#{@start_time}' with duration #{@duration} and programme #{@programme}"
end

#similar_to(other) ⇒ Object



30
31
32
33
34
35
# File 'lib/simple_pvr/model/recording.rb', line 30

def similar_to(other)
  other != nil &&
  other.channel == @channel &&
  other.show_name == @show_name &&
  other.start_time == @start_time
end

#update_with(other) ⇒ Object



37
38
39
40
# File 'lib/simple_pvr/model/recording.rb', line 37

def update_with(other)
  @duration = other.duration
  @programme = other.programme
end