Class: Orchestra::Performance::Movement

Inherits:
Object
  • Object
show all
Defined in:
lib/orchestra/performance.rb

Direct Known Subclasses

CollectionMovement, EmbeddedOperation

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node, performance) ⇒ Movement

Returns a new instance of Movement.



77
78
79
80
81
# File 'lib/orchestra/performance.rb', line 77

def initialize node, performance
  @node = node
  @performance = performance
  @context = build_context performance
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



75
76
77
# File 'lib/orchestra/performance.rb', line 75

def context
  @context
end

#nodeObject (readonly)

Returns the value of attribute node.



75
76
77
# File 'lib/orchestra/performance.rb', line 75

def node
  @node
end

#performanceObject (readonly)

Returns the value of attribute performance.



75
76
77
# File 'lib/orchestra/performance.rb', line 75

def performance
  @performance
end

Class Method Details

.perform(node, *args) ⇒ Object



65
66
67
68
69
70
71
72
73
# File 'lib/orchestra/performance.rb', line 65

def self.perform node, *args
  if node.is_a? Operation
    klass = EmbeddedOperation
  else
    klass = node.collection ? CollectionMovement : self
  end
  instance = klass.new node, *args
  node.process instance.perform
end

Instance Method Details

#build_context(performance) ⇒ Object



87
88
89
# File 'lib/orchestra/performance.rb', line 87

def build_context performance
  node.build_context performance.state
end

#performObject



83
84
85
# File 'lib/orchestra/performance.rb', line 83

def perform
  context.perform
end