Class: Agqr::Recorder::Job
- Inherits:
-
Object
- Object
- Agqr::Recorder::Job
- Defined in:
- lib/agqr/recorder/job.rb
Instance Attribute Summary collapse
-
#program ⇒ Object
readonly
Returns the value of attribute program.
-
#recorder ⇒ Object
readonly
Returns the value of attribute recorder.
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
- #build(program) ⇒ Object
-
#initialize(recorder) ⇒ Job
constructor
A new instance of Job.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(recorder) ⇒ Job
Returns a new instance of Job.
10 11 12 |
# File 'lib/agqr/recorder/job.rb', line 10 def initialize(recorder) @recorder = recorder end |
Instance Attribute Details
#program ⇒ Object (readonly)
Returns the value of attribute program.
8 9 10 |
# File 'lib/agqr/recorder/job.rb', line 8 def program @program end |
#recorder ⇒ Object (readonly)
Returns the value of attribute recorder.
8 9 10 |
# File 'lib/agqr/recorder/job.rb', line 8 def recorder @recorder end |
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
8 9 10 |
# File 'lib/agqr/recorder/job.rb', line 8 def thread @thread end |
Instance Method Details
#build(program) ⇒ Object
14 15 16 |
# File 'lib/agqr/recorder/job.rb', line 14 def build(program) @program = Program.new(program) end |
#start ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/agqr/recorder/job.rb', line 18 def start @thread = Thread.new do Chrono::Trigger.new(program.schedule) do recorder.record self end.run end end |
#stop ⇒ Object
26 27 28 |
# File 'lib/agqr/recorder/job.rb', line 26 def stop thread.kill end |