Class: Build
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Build
- Includes:
- Magi::Proprietary
- Defined in:
- app/models/build.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#enqueue ⇒ Object
Pushes this build to worker’s queue.
-
#run ⇒ Object
Runs this build, usually called from BuildWorker#perform.
-
#sec ⇒ Object
Returns elapsed sec as a Float or nil.
- #status_name ⇒ Object
Methods included from Magi::Proprietary
Class Method Details
.latest ⇒ Object
22 23 24 |
# File 'app/models/build.rb', line 22 def self.latest recent.first end |
Instance Method Details
#enqueue ⇒ Object
Pushes this build to worker’s queue.
27 28 29 |
# File 'app/models/build.rb', line 27 def enqueue BuildWorker.perform_async(id) end |
#run ⇒ Object
Runs this build, usually called from BuildWorker#perform.
32 33 34 35 |
# File 'app/models/build.rb', line 32 def run start finish(job.run) end |
#sec ⇒ Object
Returns elapsed sec as a Float or nil.
38 39 40 |
# File 'app/models/build.rb', line 38 def sec finished_at - started_at if finished_at && started_at end |
#status_name ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'app/models/build.rb', line 42 def status_name case status when true "success" when false "failure" when nil "unfinished" end end |