Module: CouchPublish
- Defined in:
- lib/couch_publish/couch_publish.rb
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Object) discard_draft
Discard the working draft, and revert the document back to the last published state, but don't save.
-
- (Object) discard_draft!(&block)
Discard the working draft, and revert the document back to the last published version.
-
- (Boolean) draft?
Returns true if this version has not been published.
-
- (Object) last_published_version
Returns the latest version of the document that was published.
-
- (Boolean) previously_published?
Has any of version of this document ever been published?.
- - (Object) publish!(&block)
-
- (Boolean) published?
Returns true if this version is published.
- - (Object) published_versions
Class Method Details
+ (Object) included(base)
2 3 4 |
# File 'lib/couch_publish/couch_publish.rb', line 2 def self.included(base) base.send :include, Memories unless base.ancestors.include? Memories end |
Instance Method Details
- (Object) discard_draft
Discard the working draft, and revert the document back to the last published state, but don't save. Note that if you save the document after calling this method, you would still have to call the publish! method if you want the revert to be published
44 45 46 47 48 |
# File 'lib/couch_publish/couch_publish.rb', line 44 def discard_draft discard_draft_exception_check self.rollback_to_latest_milestone self end |
- (Object) discard_draft!(&block)
Discard the working draft, and revert the document back to the last published version
32 33 34 35 36 37 |
# File 'lib/couch_publish/couch_publish.rb', line 32 def discard_draft!(&block) discard_draft_exception_check self.rollback_to_latest_milestone! self.publish! &block self end |
- (Boolean) draft?
Returns true if this version has not been published
16 17 18 |
# File 'lib/couch_publish/couch_publish.rb', line 16 def draft? not self.published? end |
- (Object) last_published_version
Returns the latest version of the document that was published
21 22 23 |
# File 'lib/couch_publish/couch_publish.rb', line 21 def last_published_version self.milestones.empty? ? nil : self.milestones.last.instance end |
- (Boolean) previously_published?
Has any of version of this document ever been published?
26 27 28 |
# File 'lib/couch_publish/couch_publish.rb', line 26 def previously_published? not self.milestones.empty? end |
- (Object) publish!(&block)
6 7 8 |
# File 'lib/couch_publish/couch_publish.rb', line 6 def publish!(&block) self.milestone! &block end |
- (Boolean) published?
Returns true if this version is published
11 12 13 |
# File 'lib/couch_publish/couch_publish.rb', line 11 def published? self.milestone? or self.milestone_commit? end |
- (Object) published_versions
50 51 52 |
# File 'lib/couch_publish/couch_publish.rb', line 50 def published_versions self.milestones end |