Class: Flock::ExecuteOperations

Inherits:
Object
  • Object
show all
Defined in:
lib/flock/operations/execute_operations.rb

Instance Method Summary collapse

Constructor Details

#initialize(service, priority, execute_at = nil) ⇒ ExecuteOperations

Returns a new instance of ExecuteOperations.



3
4
5
# File 'lib/flock/operations/execute_operations.rb', line 3

def initialize(service, priority, execute_at = nil)
  @service, @operations, @priority, @execute_at = service, [], priority, execute_at
end

Instance Method Details

#applyObject



12
13
14
# File 'lib/flock/operations/execute_operations.rb', line 12

def apply
  @service.execute(to_thrift)
end

#to_thriftObject



16
17
18
19
20
21
22
# File 'lib/flock/operations/execute_operations.rb', line 16

def to_thrift
  operations = Edges::ExecuteOperations.new
  operations.operations = @operations.map(&:to_thrift)
  operations.priority = @priority
  operations.execute_at = @execute_at.to_i if @execute_at
  operations
end