Module: Turbine

Defined in:
lib/turbine/edge.rb,
lib/turbine/node.rb,
lib/turbine/graph.rb,
lib/turbine/errors.rb,
lib/turbine/version.rb,
lib/turbine/properties.rb,
lib/turbine/pipeline/dsl.rb,
lib/turbine/pipeline/pump.rb,
lib/turbine/pipeline/split.rb,
lib/turbine/pipeline/trace.rb,
lib/turbine/traversal/base.rb,
lib/turbine/pipeline/filter.rb,
lib/turbine/pipeline/sender.rb,
lib/turbine/pipeline/unique.rb,
lib/turbine/pipeline/journal.rb,
lib/turbine/pipeline/segment.rb,
lib/turbine/algorithms/tarjan.rb,
lib/turbine/pipeline/expander.rb,
lib/turbine/pipeline/transform.rb,
lib/turbine/pipeline/traversal.rb,
lib/turbine/traversal/depth_first.rb,
lib/turbine/pipeline/journal_filter.rb,
lib/turbine/traversal/breadth_first.rb,
lib/turbine/algorithms/filtered_tarjan.rb

Defined Under Namespace

Modules: Algorithms, Pipeline, Properties, Traversal Classes: CyclicError, Edge, Graph, Node

Constant Summary collapse

TurbineError =

Error class which serves as a base for all errors which occur in Turbine.

Class.new(StandardError)
DuplicateNodeError =

Added a node to a graph, when one already exists with the same key.

error_class do |key|
  "Graph already has a node with the key #{ key.inspect }"
end
NoSuchNodeError =

Attempted an operation on a Node which does not exist.

error_class do |key|
  "Graph does not contain a node with the key #{ key.inspect }"
end
DuplicateEdgeError =

Added an edge between two nodes which was too similar to an existing edge. See Edge#similar?

error_class do |node, edge|
  "Another edge already exists on #{ node.inspect } which is too similar " \
  "to #{ edge.inspect }"
end
InvalidPropertiesError =

Attempted to set properties on an object, when the properties were not in the form of a hash, or were otherwise invalid in some way.

error_class do |model, properties|
  "Tried to assign properties #{ properties.inspect } on " \
  "#{ model.inspect } - it must be a Hash, or subclass of Hash"
end
NoSuchJournalError =

Tried to access values from a non-existant Journal segment.

error_class do |name|
  "No such upstream journal: #{ name.inspect }"
end
TracingNotEnabledError =

Attempted to get trace information from a pipeline when tracing has not been enabled.

error_class do |segment|
  "You cannot get trace information from the #{ segment.inspect } " \
  "segment as tracing is not enabled"
end
NotTraceableError =

Tried to enable tracing on a segment which doesn’t support it.

error_class do |segment|
  "You cannot enable tracing on pipelines with #{ segment.class.name } " \
  "segments"
end
VERSION =

The current version of the Turbine library.

'0.1.3'

Class Method Summary collapse

Class Method Details

.error_class(superclass = TurbineError, &block) ⇒ Object

Internal: Creates a new error class which inherits from TurbineError, whose message is created by evaluating the block you give.

For example

MyError = error_class do |weight, limit|
  "#{ weight } exceeds #{ limit }"
end

raise MyError.new(5000, 2500)
# => #<Turbine::MyError: 5000 exceeds 2500>

Returns an exception class.



18
19
20
21
22
23
# File 'lib/turbine/errors.rb', line 18

def self.error_class(superclass = TurbineError, &block)
  Class.new(superclass) do
    def initialize(*args) ; super(make_message(*args)) ; end
    define_method(:make_message, &block)
  end
end