class Resilience::Files

Public Instance Methods

at(path) click to toggle source
# File lib/resilience/collections/files.rb, line 15
def at(path)
  find { |f| f.fullname == path }
end
byte_map() click to toggle source
# File lib/resilience/collections/files.rb, line 19
def byte_map
  bytes = []
  each do |file|
    0.upto(file.metadata.size-1) do |byte_index|
      bytes[byte_index] ||= {}
      bytes[byte_index][file] = file.metadata[byte_index]
    end
  end
  bytes
end
bytes_diff() click to toggle source
# File lib/resilience/collections/files.rb, line 30
def bytes_diff
  map = byte_map
  different_bytes = []
  0.upto(map.size-1).each do |byte_index|
    bytes = map[byte_index].values
    different = bytes.uniq.size != 1 || bytes.size != size
    different_bytes << (different ? map[byte_index] : nil)
  end
  different_bytes
end
fullnames() click to toggle source
# File lib/resilience/collections/files.rb, line 11
def fullnames
  collect { |f| f.fullname }
end
names() click to toggle source
# File lib/resilience/collections/files.rb, line 7
def names
  collect { |f| f.name }
end