class Docker::Event

This class represents a Docker Event.

Attributes

from[RW]
id[RW]
status[RW]
time[RW]

Public Class Methods

new(status, id, from, time) click to toggle source
# File lib/docker/event.rb, line 7
def initialize(status, id, from, time)
  @status, @id, @from, @time = status, id, from, time
end
new_event(body, remaining, total) click to toggle source
# File lib/docker/event.rb, line 29
def new_event(body, remaining, total)
  return if body.nil? || body.empty?
  json = Docker::Util.parse_json(body)
  Docker::Event.new(
    json['status'],
    json['id'],
    json['from'],
    json['time']
  )
end
since(since, opts = {}, conn = Docker.connection, &block) click to toggle source
# File lib/docker/event.rb, line 25
def since(since, opts = {}, conn = Docker.connection, &block)
  stream(opts.merge(:since => since), conn, &block)
end
stream(opts = {}, conn = Docker.connection, &block) click to toggle source
# File lib/docker/event.rb, line 19
def stream(opts = {}, conn = Docker.connection, &block)
  conn.get('/events', opts, :response_block => lambda { |b, r, t|
    block.call(new_event(b, r, t))
  })
end

Public Instance Methods

to_s() click to toggle source
# File lib/docker/event.rb, line 11
def to_s
  "Docker::Event { :status => #{self.status}, :id => #{self.id}, "\
    ":from => #{self.from}, :time => #{self.time} }"
end