Class: EventAction

Inherits:
Action show all
Defined in:
lib/MINT-core/mapping/action/event_action.rb

Instance Method Summary collapse

Methods inherited from Action

#finished_callback, #id, #identifier, #initiated_callback

Constructor Details

#initialize(params) ⇒ EventAction

BackendAction.new(:call => CUIControl.method(:find_cio_from_coordinates))



3
4
5
6
# File 'lib/MINT-core/mapping/action/event_action.rb', line 3

def initialize(params)
  super()
  @action = params
end

Instance Method Details

#eventObject



8
9
10
# File 'lib/MINT-core/mapping/action/event_action.rb', line 8

def event
  @action[:event]
end

#selectorObject



16
17
18
# File 'lib/MINT-core/mapping/action/event_action.rb', line 16

def selector
  @action[:selector]
end

#start(observation_results) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/MINT-core/mapping/action/event_action.rb', line 20

def start(observation_results)
  @result = false
  results  = []
  interactor_data= observation_results[target]

  interactor_data = [interactor_data] if not interactor_data.kind_of?(Array)

  interactor_data.each do |int_data|
    interactor = MINT::Interactor.get(int_data["mint_model"],int_data["name"])
    interactor = interactor.method(selector).call if not selector.nil?

    results << interactor.process_event(event)

  end

  @result = true if results != nil and results.count(nil)==0

  self
end

#targetObject



12
13
14
# File 'lib/MINT-core/mapping/action/event_action.rb', line 12

def target
  @action[:target]
end