Class: NetworkExecutive::ScheduledProgram
- Inherits:
-
Object
- Object
- NetworkExecutive::ScheduledProgram
- Defined in:
- lib/network_executive/scheduled_program.rb
Instance Attribute Summary collapse
-
#occurrence ⇒ Object
Returns the value of attribute occurrence.
-
#portion ⇒ Object
Returns the value of attribute portion.
-
#program ⇒ Object
Returns the value of attribute program.
-
#remainder ⇒ Object
Returns the value of attribute remainder.
Instance Method Summary collapse
-
#+(other_program) ⇒ Object
Extends this scheduled program with another program of the same type.
- #display_name ⇒ Object
-
#initialize(*args) ⇒ ScheduledProgram
constructor
A new instance of ScheduledProgram.
Constructor Details
#initialize(*args) ⇒ ScheduledProgram
Returns a new instance of ScheduledProgram.
5 6 7 |
# File 'lib/network_executive/scheduled_program.rb', line 5 def initialize( *args ) @program, @occurrence, @remainder, @portion = *args end |
Instance Attribute Details
#occurrence ⇒ Object
Returns the value of attribute occurrence.
3 4 5 |
# File 'lib/network_executive/scheduled_program.rb', line 3 def occurrence @occurrence end |
#portion ⇒ Object
Returns the value of attribute portion.
3 4 5 |
# File 'lib/network_executive/scheduled_program.rb', line 3 def portion @portion end |
#program ⇒ Object
Returns the value of attribute program.
3 4 5 |
# File 'lib/network_executive/scheduled_program.rb', line 3 def program @program end |
#remainder ⇒ Object
Returns the value of attribute remainder.
3 4 5 |
# File 'lib/network_executive/scheduled_program.rb', line 3 def remainder @remainder end |
Instance Method Details
#+(other_program) ⇒ Object
Extends this scheduled program with another program of the same type.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/network_executive/scheduled_program.rb', line 14 def +( other_program ) raise ArgumentError if @program.class != other_program.class additional_duration = other_program.duration + 1 program.duration += additional_duration occurrence.duration += additional_duration occurrence.end_time += additional_duration self end |
#display_name ⇒ Object
9 10 11 |
# File 'lib/network_executive/scheduled_program.rb', line 9 def display_name program.display_name end |