Class: Resilience::Files
- Defined in:
- lib/resilience/collections/files.rb
Instance Method Summary collapse
Methods inherited from Array
Instance Method Details
#at(path) ⇒ Object
15 16 17 |
# File 'lib/resilience/collections/files.rb', line 15 def at(path) find { |f| f.fullname == path } end |
#byte_map ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/resilience/collections/files.rb', line 19 def byte_map bytes = [] each do |file| 0.upto(file..size-1) do |byte_index| bytes[byte_index] ||= {} bytes[byte_index][file] = file.[byte_index] end end bytes end |
#bytes_diff ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# 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 ⇒ Object
11 12 13 |
# File 'lib/resilience/collections/files.rb', line 11 def fullnames collect { |f| f.fullname } end |
#names ⇒ Object
7 8 9 |
# File 'lib/resilience/collections/files.rb', line 7 def names collect { |f| f.name } end |