Sha256: dd4583126e97ce782fe3390a2eaafaa0048ea8a9a4003050f6bbb093a28f3699

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

# frozen_string_literal: true

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

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

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enumark-0.1.4 lib/enumark/dir.rb