Class: Enumark::Dir

Inherits:
Object
  • Object
show all
Defined in:
lib/enumark/dir.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ Dir

Returns a new instance of Dir.


5
6
7
8
# File 'lib/enumark/dir.rb', line 5

def initialize(dir)
  @enumarks = ::Dir.glob(dir).map{ |f| ::Enumark.new(f) }
  raise 'Not enough to process' if @enumarks.count <= 1
end

Instance Method Details

#addedObject


10
11
12
# File 'lib/enumark/dir.rb', line 10

def added
  @added ||= (@enumarks[-1] - @enumarks[-2])
end

#deletedObject


14
15
16
# File 'lib/enumark/dir.rb', line 14

def deleted
  @deleted ||= @enumarks[0..-2].reverse_each.reduce(&:|) - @enumarks[-1]
end

#staticObject


22
23
24
# File 'lib/enumark/dir.rb', line 22

def static
  @static ||= @enumarks.reverse_each.reduce(&:&)
end

#uniqObject


18
19
20
# File 'lib/enumark/dir.rb', line 18

def uniq
  @uniq ||= @enumarks.reverse_each.reduce(&:|)
end