class Escalator::EscalatorConfigTarget
Public Class Methods
finalize()
click to toggle source
# File lib/escalator/config_target.rb, line 38 def finalize proc { EmuPlcServer.terminate } end
new(options={})
click to toggle source
# File lib/escalator/config_target.rb, line 46 def initialize options={} @target_info = options ObjectSpace.define_finalizer(self, self.class.finalize) end
Public Instance Methods
method_missing(name, *args)
click to toggle source
# File lib/escalator/config_target.rb, line 71 def method_missing(name, *args) name = name.to_s unless name.is_a? String case name.to_s when /(.*)=$/ @target_info[$1.to_sym] = args.first else @target_info[name.to_sym] end end
protocol()
click to toggle source
# File lib/escalator/config_target.rb, line 51 def protocol @protocol ||= begin p = eval("#{@target_info[:protocol].camelize}.new") p.host = @target_info[:host] if @target_info[:host] p.port = @target_info[:port] if @target_info[:port] p.log_level = @target_info[:log_level] if @target_info[:log_level] p rescue nil end end
run()
click to toggle source
# File lib/escalator/config_target.rb, line 81 def run case self.name when :emulator Plc::Emulator::EmuPlcServer.launch else # DO NOTHIN # Actual device is running independently. end end
uploader()
click to toggle source
# File lib/escalator/config_target.rb, line 63 def uploader @uploader ||= begin u = Uploader.new u.protocol = self.protocol u end end