class Docker::Event
Constants
- Actor
Attributes
Action[RW]
Actor[R]
Type[RW]
action[RW]
actor[R]
from[RW]
Deprecated interface
status[RW]
Deprecated interface
time[RW]
timeNano[RW]
time_nano[RW]
type[RW]
Public Class Methods
new(event_attributes = {})
click to toggle source
# File lib/docker/event.rb, line 56 def initialize(event_attributes = {}) [:Type, :Action, :Actor, :time, :timeNano, :status, :from].each do |sym| value = event_attributes[sym] if value.nil? value = event_attributes[sym.to_s] end send("#{sym}=", value) end if @Actor.nil? value = event_attributes[:id] if value.nil? value = event_attributes['id'] end self.Actor = Actor.new(ID: value) end end
new_event(body, remaining, total)
click to toggle source
# File lib/docker/event.rb, line 44 def new_event(body, remaining, total) return if body.nil? || body.empty? json = Docker::Util.parse_json(body) Docker::Event.new(json) end
since(since, opts = {}, conn = Docker.connection, &block)
click to toggle source
# File lib/docker/event.rb, line 40 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 32 def stream(opts = {}, conn = Docker.connection, &block) conn.get('/events', opts, :response_block => lambda { |b, r, t| b.each_line do |line| block.call(new_event(line, r, t)) end }) end
Public Instance Methods
Actor=(actor)
click to toggle source
# File lib/docker/event.rb, line 78 def Actor=(actor) return if actor.nil? if actor.is_a? Actor @Actor = actor else @Actor = Actor.new(actor) end end
ID()
click to toggle source
# File lib/docker/event.rb, line 74 def ID self.actor.ID end
Also aliased as: id
to_s()
click to toggle source
# File lib/docker/event.rb, line 93 def to_s if type.nil? && action.nil? to_s_legacy else to_s_actor_style end end
Private Instance Methods
to_s_actor_style()
click to toggle source
# File lib/docker/event.rb, line 114 def to_s_actor_style most_accurate_time = time_nano || time attributes = [] actor.attributes.each do |attribute, value| attributes << "#{attribute}=#{value}" end unless attributes.empty? attribute_string = "(#{attributes.join(', ')}) " end "Docker::Event { #{most_accurate_time} #{type} #{action} #{actor.id} #{attribute_string}}" end
to_s_legacy()
click to toggle source
# File lib/docker/event.rb, line 103 def to_s_legacy attributes = [] attributes << "from=#{from}" unless from.nil? unless attributes.empty? attribute_string = "(#{attributes.join(', ')}) " end "Docker::Event { #{time} #{status} #{id} #{attribute_string}}" end