Sha256: 21459596148c3097842177d14fa56a3bcfd44b7a26a871d0f00e371dcf875fbb

Contents?: true

Size: 1.24 KB

Versions: 10

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

module Attr
  module Gather
    module Workflow
      # Module containing graph functionality
      #
      # @api public
      module Graphable
        # Class methods for graph functionality
        module ClassMethods
          # Returns the graph of tasks
          #
          # @return [TaskGraph] the graph
          #
          # @api private
          def tasks
            @tasks ||= TaskGraph.new
          end

          # Returns a graphviz visualization of the workflow
          #
          # @param preview [Boolean] show a preview image of the Workflow
          #
          # @api public
          def to_dot(preview: true)
            tasks.to_dot(preview: preview)
          end
        end

        # Instance methods for graph functionality
        module InstanceMethods
          # Returns a graphviz visualization of the workflow
          #
          # @param preview [Boolean] show a preview image of the Workflow
          #
          # @api public
          def to_dot(preview: true)
            self.class.to_dot(preview: preview)
          end
        end

        def self.included(klass)
          klass.extend(ClassMethods)
          klass.include(InstanceMethods)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
attr-gather-1.5.1 lib/attr/gather/workflow/graphable.rb
attr-gather-1.4.0 lib/attr/gather/workflow/graphable.rb
attr-gather-1.2.1 lib/attr/gather/workflow/graphable.rb
attr-gather-1.3.0 lib/attr/gather/workflow/graphable.rb
attr-gather-1.2.0 lib/attr/gather/workflow/graphable.rb
attr-gather-1.1.3 lib/attr/gather/workflow/graphable.rb
attr-gather-1.1.2 lib/attr/gather/workflow/graphable.rb
attr-gather-1.1.1 lib/attr/gather/workflow/graphable.rb
attr-gather-1.1.0 lib/attr/gather/workflow/graphable.rb
attr-gather-1.0.0 lib/attr/gather/workflow/graphable.rb