Class: Zenaton::Workflows::Version Abstract

Inherits:
Interfaces::Workflow show all
Includes:
Traits::Zenatonable
Defined in:
lib/zenaton/workflows/version.rb

Overview

This class is abstract.

Subclass and override #versions to create your own versionned

workflows

Instance Method Summary collapse

Methods included from Traits::Zenatonable

#dispatch, #execute

Methods inherited from Interfaces::Workflow

#id

Constructor Details

#initialize(*args) ⇒ Version

Returns a new instance of Version.



22
23
24
# File 'lib/zenaton/workflows/version.rb', line 22

def initialize(*args)
  @args = args
end

Instance Method Details

#currentClass

Get the current implementation class

Returns:

  • (Class)


33
34
35
# File 'lib/zenaton/workflows/version.rb', line 33

def current
  _get_versions[-1]
end

#current_implementationZenaton::Interfaces::Workflow

Returns an instance of the current implementation



45
46
47
# File 'lib/zenaton/workflows/version.rb', line 45

def current_implementation
  current.new(*@args)
end

#handleObject

Calls handle on the current implementation



27
28
29
# File 'lib/zenaton/workflows/version.rb', line 27

def handle
  current_implementation.handle
end

#initialClass

Get the first implementation class

Returns:

  • (Class)


39
40
41
# File 'lib/zenaton/workflows/version.rb', line 39

def initial
  _get_versions[0]
end

#versionsArray<Class>

version, ordered from the oldest to the most recent version

Returns:

  • (Array<Class>)

    an array containing the class name for each

Raises:



17
18
19
20
# File 'lib/zenaton/workflows/version.rb', line 17

def versions
  raise NotImplemented,
        "Please override the `versions' method in your subclass"
end