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, url) ⇒ DefaultHistory

Returns a new instance of DefaultHistory.



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

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

  @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



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

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



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

def clear
  @revisions.clear
end

#loadObject



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

def load
end

#revision_changed?(rev1, rev2) ⇒ Boolean

Returns:

  • (Boolean)


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

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



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

def store
end