class FluentECS::Container
Attributes
docker_id[RW]
docker_name[RW]
name[RW]
task[RW]
Public Class Methods
cache()
click to toggle source
# File lib/fluent_ecs/container.rb, line 45 def cache @cache ||= LruRedux::TTL::ThreadSafeCache.new( FluentECS.config.cache_size, FluentECS.config.cache_ttl ) end
find(docker_id)
click to toggle source
# File lib/fluent_ecs/container.rb, line 52 def find(docker_id) cache.getset(docker_id) do Metadata.take.containers.each { |c| cache[c.docker_id] = c } cache[docker_id] # cache value nil if container is not in response end end
new(attrs = {})
click to toggle source
# File lib/fluent_ecs/container.rb, line 15 def initialize(attrs = {}) @docker_id = attrs['DockerId'] @docker_name = attrs['DockerName'] @name = attrs['Name'] end
Public Instance Methods
method_missing(method_id, *args, &_block)
click to toggle source
Calls superclass method
# File lib/fluent_ecs/container.rb, line 21 def method_missing(method_id, *args, &_block) if method_id == :to_h self.class.class_eval hash_definition to_h else super end end
respond_to_missing?(method_id, include_private = false)
click to toggle source
Calls superclass method
# File lib/fluent_ecs/container.rb, line 30 def respond_to_missing?(method_id, include_private = false) method_id == :to_h || super end
Private Instance Methods
hash_definition()
click to toggle source
# File lib/fluent_ecs/container.rb, line 34 def hash_definition fields = FluentECS.config.fields %( def to_h { #{fields.map { |f| "'#{f}' => #{f}" }.join(',')} } end ) end