Sha256: 2af6f1fdb69b2125d3a83e7f3283261ab593e0147c340306544ed2199d9962b3

Contents?: true

Size: 786 Bytes

Versions: 5

Compression:

Stored size: 786 Bytes

Contents

#
# Store and retrieve a history by provider and uuid
#

require 'revision'

module DiffNews

  class DefaultHistory
    attr_reader :revisions

    def initialize provider, uuid
      @provider = provider
      @uuid = uuid

      @revisions = []
    end
  
    def load
    end

    def store
    end

    def revision_changed? rev1, rev2
      return true if rev1 == nil
      return rev1.title != rev2.title || rev1.teaser != rev2.teaser || rev1.text != rev2.text
    end

    def append_changed_revision title, teaser, text
      new_revision = Revision.new @provider, @uuid, @revisions.count, title, teaser, text
      if revision_changed? @revisions.last, new_revision
        @revisions << new_revision
      end
    end

    def clear
      @revisions.clear
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
diff_news-0.9.4 lib/default_history.rb
diff_news-0.9.3 lib/default_history.rb
diff_news-0.9.2 lib/default_history.rb
diff_news-0.9.1 lib/default_history.rb
diff_news-0.9.0 lib/default_history.rb