class Paradeiser::Scheduled

Attributes

finished_at[RW]
id[RW]
started_at[RW]

Public Class Methods

new() click to toggle source
# File lib/paradeiser/models/scheduled.rb, line 7
def initialize
  @id = nil
end

Public Instance Methods

as_json(*options) click to toggle source
Calls superclass method
# File lib/paradeiser/models/scheduled.rb, line 31
def as_json(*options)
  {:type => name.titlecase, :length => length}.merge(super(*options))
end
duration() click to toggle source

from github.com/travis-ci/travis/blob/master/lib/travis/client/job.rb

# File lib/paradeiser/models/scheduled.rb, line 16
def duration
  start  = started_at  || Time.now
  finish = finished_at || Time.now
  (finish - start).to_i
end
name() click to toggle source
# File lib/paradeiser/models/scheduled.rb, line 27
def name
  self.class.name.split("::").last.downcase
end
new?() click to toggle source
# File lib/paradeiser/models/scheduled.rb, line 11
def new?
  @id.nil?
end
remaining() click to toggle source
# File lib/paradeiser/models/scheduled.rb, line 22
def remaining
  raise NotActiveError unless active?
  length - Time.now.to_i + started_at.to_i
end