Module: OscMacheteRails::Workflow

Defined in:
lib/osc_machete_rails/workflow.rb

Overview

A plugin to maintain a workflow for Jobs.

Defined Under Namespace

Modules: BuilderMethods, JobsRelation, StatusMethods

Instance Method Summary collapse

Instance Method Details

#has_machete_workflow_of(jobs_active_record_relation_symbol) ⇒ Object

Registers a workflow relationship and sets up a hook to additional builder methods.

Parameters:

  • jobs_active_record_relation_symbol (Symbol)

    The Job Identifier



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/osc_machete_rails/workflow.rb', line 8

def has_machete_workflow_of(jobs_active_record_relation_symbol)
  # yes, this is magic mimicked from http://guides.rubyonrails.org/plugins.html
  #  and http://yehudakatz.com/2009/11/12/better-ruby-idioms/
  cattr_accessor :jobs_active_record_relation_symbol
  self.jobs_active_record_relation_symbol = jobs_active_record_relation_symbol

  # separate modules to group common methods for readability purposes
  # both builder methods and status methods need the jobs relation so
  # we include that first
  self.send :include, OscMacheteRails::Workflow::JobsRelation
  self.send :include, OscMacheteRails::Workflow::BuilderMethods
  self.send :include, OscMacheteRails::Workflow::StatusMethods
end