require_relative 'diff'
require_relative 'diff_collection'

module SubDiff
  class Differ
    def initialize(diffable)
      @diffable = diffable
      @collection = DiffCollection.new
    end

    def diff(*args, &block)
      diff!(*args, &block)

      if collection.empty?
        collection << Diff.new(diffable)
      end

      collection
    end

    private

    attr_reader :diffable, :collection

    def diff!(*args, &block)
    end
  end
end

require_relative 'diff'
require_relative 'diff_collection'

module SubDiff
  class Differ
    attr_reader :diffable, :collection

    def initialize(diffable)
      @diffable = diffable
      @collection = DiffCollection.new
    end

    def diff(*args, &block)
      diff!(*args, &block)

      if collection.empty?
        collection << Diff.new(diffable)
      end

      collection
    end

    private

    def diff!(*args, &block)
    end
  end
end

Make readers public to avoid weird ruby warnings
Make readers public to avoid weird ruby warnings

See https://github.com/thoughtbot/guides/pull/190
See https://twitter.com/tomstuart/status/486143792140271616
