Class: Enumark::Dir
- Inherits:
-
Object
- Object
- Enumark::Dir
- Defined in:
- lib/enumark/dir.rb
Instance Method Summary collapse
- #added ⇒ Object
- #all ⇒ Object
- #deleted ⇒ Object
-
#initialize(dir) ⇒ Dir
constructor
A new instance of Dir.
- #static ⇒ Object
- #uniq ⇒ Object
Constructor Details
Instance Method Details
#added ⇒ Object
10 11 12 |
# File 'lib/enumark/dir.rb', line 10 def added @added ||= (@enumarks[-1] - @enumarks[-2]) end |
#all ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/enumark/dir.rb', line 26 def all Enumerator.new do |yielder| logger = Config.get(:logger) file_count = @enumarks.count @enumarks.each_with_index do |enum, idx| enum.each do |item| yielder << item logger.printf("--> %6d/%-6d = %3f \r", idx + 1, file_count, ((idx + 1).to_f / file_count * 100).round(2)) if logger end end logger.puts if logger end end |
#deleted ⇒ Object
14 15 16 |
# File 'lib/enumark/dir.rb', line 14 def deleted @deleted ||= @enumarks[0..-2].reverse_each.reduce(&:|) - @enumarks[-1] end |
#static ⇒ Object
22 23 24 |
# File 'lib/enumark/dir.rb', line 22 def static @static ||= @enumarks.reverse_each.reduce(&:&) end |
#uniq ⇒ Object
18 19 20 |
# File 'lib/enumark/dir.rb', line 18 def uniq @uniq ||= @enumarks.reverse_each.reduce(&:|) end |