Class: SimplePvr::Model::Schedule

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/simple_pvr/model/schedule.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_exception(options) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/simple_pvr/model/schedule.rb', line 20

def self.add_exception(options)
  Schedule.create(
    type: :exception,
    title: options[:title],
    channel: options[:channel],
    start_time: options[:start_time],
    end_time: options[:end_time])
end

.add_specification(options) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/simple_pvr/model/schedule.rb', line 11

def self.add_specification(options)
  Schedule.create(
    type: :specification,
    title: options[:title],
    channel: options[:channel],
    start_time: options[:start_time],
    end_time: options[:end_time])
end

.cleanupObject



7
8
9
# File 'lib/simple_pvr/model/schedule.rb', line 7

def self.cleanup
  Schedule.all(:end_time.lt => Time.now).each {|s| s.destroy }
end

Instance Method Details

#end_late_minutesObject



60
61
62
# File 'lib/simple_pvr/model/schedule.rb', line 60

def end_late_minutes
  custom_end_late_minutes || 5
end

#start_early_minutesObject



56
57
58
# File 'lib/simple_pvr/model/schedule.rb', line 56

def start_early_minutes
  custom_start_early_minutes || 2
end