Class: Docker::ContainerPathStat

Inherits:
Object
  • Object
show all
Defined in:
lib/drydock/docker_api_patch.rb

Instance Method Summary collapse

Constructor Details

#initialize(definition) ⇒ ContainerPathStat

Returns a new instance of ContainerPathStat.



63
64
65
# File 'lib/drydock/docker_api_patch.rb', line 63

def initialize(definition)
  @data = JSON.parse(Base64.decode64(definition))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *method_args, &blk) ⇒ Object



71
72
73
74
75
76
77
# File 'lib/drydock/docker_api_patch.rb', line 71

def method_missing(method_name, *method_args, &blk)
  if mode.respond_to?(method_name)
    mode.public_send(method_name, *method_args, &blk)
  else
    super
  end
end

Instance Method Details



67
68
69
# File 'lib/drydock/docker_api_patch.rb', line 67

def link_target
  @data.fetch('linkTarget')
end

#modeObject



79
80
81
# File 'lib/drydock/docker_api_patch.rb', line 79

def mode
  @mode ||= UniversalFileMode.new(@data.fetch('mode'))
end

#mtimeObject



83
84
85
# File 'lib/drydock/docker_api_patch.rb', line 83

def mtime
  @mtime ||= DateTime.parse(@data.fetch('mtime'))
end

#nameObject



87
88
89
# File 'lib/drydock/docker_api_patch.rb', line 87

def name
  @data.fetch('name')
end

#respond_to?(method_name) ⇒ Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/drydock/docker_api_patch.rb', line 91

def respond_to?(method_name)
  mode.respond_to?(method_name) || super
end

#sizeObject



95
96
97
# File 'lib/drydock/docker_api_patch.rb', line 95

def size
  @data.fetch('size')
end