Class: DiffNews::DefaultHistory
- Inherits:
-
Object
- Object
- DiffNews::DefaultHistory
- Defined in:
- lib/default_history.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#revisions ⇒ Object
readonly
Returns the value of attribute revisions.
Instance Method Summary collapse
- #append_changed_revision(title, teaser, text) ⇒ Object
- #clear ⇒ Object
-
#initialize(provider, uuid, url) ⇒ DefaultHistory
constructor
A new instance of DefaultHistory.
- #load ⇒ Object
- #revision_changed?(rev1, rev2) ⇒ Boolean
- #store ⇒ Object
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
#revisions ⇒ Object (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, , text new_revision = Revision.new @provider, @uuid, @revisions.count, title, , text if revision_changed? @revisions.last, new_revision @revisions << new_revision end end |
#clear ⇒ Object
38 39 40 |
# File 'lib/default_history.rb', line 38 def clear @revisions.clear end |
#load ⇒ Object
20 21 |
# File 'lib/default_history.rb', line 20 def load end |
#revision_changed?(rev1, rev2) ⇒ 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. != rev2. || rev1.text != rev2.text end |
#store ⇒ Object
23 24 |
# File 'lib/default_history.rb', line 23 def store end |