module WorkflowStatus

Constants

VERSION
WORKFLOW_STATUS_MAP

Public Class Methods

extended(extender) click to toggle source
# File lib/workflow_status.rb, line 12
def extended(extender)
  extender.send :include, InstanceMethods
end

Public Instance Methods

published() click to toggle source
# File lib/workflow_status.rb, line 25
def published
  where(workflow_status: workflow_status_code(:published))
end
status_options_for_select() click to toggle source

for Rails form select helper

# File lib/workflow_status.rb, line 35
def status_options_for_select
  workflow_status_map.to_a
end
trashed() click to toggle source
# File lib/workflow_status.rb, line 29
def trashed
  where(workflow_status: workflow_status_code(:trashed))
end
unpublished() click to toggle source
# File lib/workflow_status.rb, line 21
def unpublished
  where(workflow_status: workflow_status_code(:unpublished))
end
workflow_statuses() click to toggle source
# File lib/workflow_status.rb, line 17
def workflow_statuses
  workflow_status_map.keys
end

Private Instance Methods

workflow_status_code(text_value) click to toggle source
# File lib/workflow_status.rb, line 41
def workflow_status_code(text_value)
  workflow_status_map.fetch text_value.to_sym
end
workflow_status_map() click to toggle source
# File lib/workflow_status.rb, line 45
def workflow_status_map
  WORKFLOW_STATUS_MAP
end