Class: EventLog

Inherits:
ArcadiaExt
  • Object
show all
Defined in:
ext/ae-event-log/ae-event-log.rb

Instance Method Summary collapse

Instance Method Details

#do_event(_event) ⇒ Object



13
14
15
16
17
18
# File 'ext/ae-event-log/ae-event-log.rb', line 13

def do_event(_event)
  if _event.context.sender!=self
    message = event_message(_event)
    Arcadia.new_msg(self, message, 'CH1')
  end
end

#event_message(_event, _ind = "") ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'ext/ae-event-log/ae-event-log.rb', line 21

def event_message(_event, _ind="") 
     message = _ind
     if _event.is_action?
       message = message + 'ACTION::'
     end
     message = message +_event.signature+" :\n"
     if _event.context
       _event.context.instance_variables.sort.each do |key| 
         _obj_value = _event.context.send(key.gsub('@',''))
         _value = _obj_value
         if _value == nil
           _value = 'nil'
         else !_value.instance_of?(String) 
           _value = _value.to_s
         end
         message = message + _ind + "\s"*2 + key+' = '+_value+"\n"
         if _obj_value != nil && _obj_value.kind_of?(ArcadiaContract::ContractEvent)
           message = message + event_message(_obj_value, _ind+"\s"*4)
         end
       end
     end
     return message
end

#on_before_build(_event) ⇒ Object



9
10
11
# File 'ext/ae-event-log/ae-event-log.rb', line 9

def on_before_build(_event)
  ArcadiaContractListener.new(self, ArcadiaContract, :do_event)
end