class Ddr::Managers::WorkflowManager

Constants

PUBLISHED
UNPUBLISHED

Public Instance Methods

publish!(include_descendants: true) click to toggle source
# File lib/ddr/managers/workflow_manager.rb, line 12
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
published?() click to toggle source
# File lib/ddr/managers/workflow_manager.rb, line 8
def published?
  object.workflow_state == PUBLISHED
end
unpublish!() click to toggle source
# File lib/ddr/managers/workflow_manager.rb, line 22
def unpublish!
  if published?
    unpublish
    object.save
  end
  if object.respond_to?(:children)
    object.children.each { |child| child.unpublish! }
  end
end

Private Instance Methods

publish() click to toggle source
# File lib/ddr/managers/workflow_manager.rb, line 34
def publish
  object.workflow_state = PUBLISHED
end
unpublish() click to toggle source
# File lib/ddr/managers/workflow_manager.rb, line 38
def unpublish
  object.workflow_state = UNPUBLISHED
end