class Docker::UniversalFileMode
Go implementation of cross-system file modes: golang.org/pkg/os/#FileMode
Constants
- BIT_FIELDS
Public Class Methods
bit_for(name)
click to toggle source
# File lib/drydock/docker_api_patch.rb, line 119 def self.bit_for(name) 32 - 1 - BIT_FIELDS.index { |field| field.keys.first == name } end
file_mode_mask()
click to toggle source
# File lib/drydock/docker_api_patch.rb, line 127 def self.file_mode_mask 0777 end
flags()
click to toggle source
# File lib/drydock/docker_api_patch.rb, line 123 def self.flags BIT_FIELDS.map { |field| field.keys.first } end
new(value)
click to toggle source
# File lib/drydock/docker_api_patch.rb, line 143 def initialize(value) @value = value end
short_flag_for(name)
click to toggle source
# File lib/drydock/docker_api_patch.rb, line 131 def self.short_flag_for(name) BIT_FIELDS.find { |field| field.keys.first == name }.values.first end
type_mode_mask()
click to toggle source
# File lib/drydock/docker_api_patch.rb, line 135 def self.type_mode_mask value_for(:directory) | value_for(:link) | value_for(:named_pipe) | value_for(:socket) | value_for(:device) end
value_for(name)
click to toggle source
# File lib/drydock/docker_api_patch.rb, line 139 def self.value_for(name) 1 << bit_for(name) end
Public Instance Methods
file_mode()
click to toggle source
# File lib/drydock/docker_api_patch.rb, line 147 def file_mode (@value & self.class.file_mode_mask) end
flags()
click to toggle source
# File lib/drydock/docker_api_patch.rb, line 151 def flags self.class.flags.select { |name| send("#{name}?") } end
regular?()
click to toggle source
# File lib/drydock/docker_api_patch.rb, line 155 def regular? (@value & self.class.type_mode_mask) == 0 end
short_flags()
click to toggle source
# File lib/drydock/docker_api_patch.rb, line 159 def short_flags flags.map { |flag| self.class.short_flag_for(flag) } end
to_s()
click to toggle source
# File lib/drydock/docker_api_patch.rb, line 163 def to_s short_flags.join end