Class: DiffNews::DefaultHistory

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

Direct Known Subclasses

FileHistory

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider, uuid) ⇒ DefaultHistory

Returns a new instance of DefaultHistory.



12
13
14
15
16
17
# File 'lib/default_history.rb', line 12

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

  @revisions = []
end

Instance Attribute Details

#revisionsObject (readonly)

Returns the value of attribute revisions.



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

def revisions
  @revisions
end

Instance Method Details

#append_changed_revision(title, teaser, text) ⇒ Object



30
31
32
33
34
35
# File 'lib/default_history.rb', line 30

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

#clearObject



37
38
39
# File 'lib/default_history.rb', line 37

def clear
  @revisions.clear
end

#loadObject



19
20
# File 'lib/default_history.rb', line 19

def load
end

#revision_changed?(rev1, rev2) ⇒ Boolean

Returns:



25
26
27
28
# File 'lib/default_history.rb', line 25

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

#storeObject



22
23
# File 'lib/default_history.rb', line 22

def store
end