class Netconf::RPC::Executor
Public Class Methods
new( trans, os_type, logging )
click to toggle source
# File lib/sloe/common.rb, line 64 def initialize( trans, os_type, logging ) @trans = trans @logging = logging begin extend Netconf::RPC::const_get( os_type ) rescue NameError # no extensions available ... end end
Public Instance Methods
method_missing( method, params = nil, attrs = nil )
click to toggle source
# File lib/sloe/common.rb, line 74 def method_missing( method, params = nil, attrs = nil ) rpc = Netconf::RPC::Builder.send( method, params, attrs ) if @logging log_attrs = attrs ? attrs : {} log_attrs[:format] = 'text' Dir.mkdir @logging[:path] File.open("#{@logging[:path]}/#{@logging[:file]}", "w") { |file| file.write rpc file.write @trans.rpc_exec( Netconf::RPC::Builder.send( method, params, log_attrs )) } end @trans.rpc_exec( rpc ) end