Class: SimplePvr::Model::Recording
- Inherits:
-
Object
- Object
- SimplePvr::Model::Recording
- Defined in:
- lib/simple_pvr/model/recording.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#conflicting ⇒ Object
Returns the value of attribute conflicting.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#programme ⇒ Object
Returns the value of attribute programme.
-
#show_name ⇒ Object
Returns the value of attribute show_name.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #conflicting? ⇒ Boolean
- #expired? ⇒ Boolean
- #expired_at(time) ⇒ Object
-
#initialize(channel, show_name, start_time, duration, programme = nil) ⇒ Recording
constructor
A new instance of Recording.
- #inspect ⇒ Object
- #similar_to(other) ⇒ Object
- #update_with(other) ⇒ Object
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
#channel ⇒ Object
Returns the value of attribute channel.
4 5 6 |
# File 'lib/simple_pvr/model/recording.rb', line 4 def channel @channel end |
#conflicting ⇒ Object
Returns the value of attribute conflicting.
4 5 6 |
# File 'lib/simple_pvr/model/recording.rb', line 4 def conflicting @conflicting end |
#duration ⇒ Object
Returns the value of attribute duration.
4 5 6 |
# File 'lib/simple_pvr/model/recording.rb', line 4 def duration @duration end |
#programme ⇒ Object
Returns the value of attribute programme.
4 5 6 |
# File 'lib/simple_pvr/model/recording.rb', line 4 def programme @programme end |
#show_name ⇒ Object
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_time ⇒ Object
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
22 23 24 |
# File 'lib/simple_pvr/model/recording.rb', line 22 def conflicting? conflicting end |
#expired? ⇒ 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 |
#inspect ⇒ Object
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 |