Sha256: ab70372c33293b84630e3b8461ee3274c01c6a5d1f715bcbb556db6fe2c5f555
Contents?: true
Size: 921 Bytes
Versions: 2
Compression:
Stored size: 921 Bytes
Contents
module Ddr module Managers class WorkflowManager < Manager PUBLISHED = "published" UNPUBLISHED = "unpublished" def published? object.workflow_state == PUBLISHED end def publish!(include_descendants: true) unless published? publish object.save! end if include_descendants && object.respond_to?(:children) object.children.each { |child| child.publish!(include_descendants: include_descendants) } end end def unpublish! if published? unpublish object.save! end if object.respond_to?(:children) object.children.each { |child| child.unpublish! } end end private def publish object.workflow_state = PUBLISHED end def unpublish object.workflow_state = UNPUBLISHED end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ddr-models-2.5.0 | lib/ddr/managers/workflow_manager.rb |
ddr-models-2.5.0.rc1 | lib/ddr/managers/workflow_manager.rb |