Class: IbRubyProxy::Server::IbWrapperAdapter
- Inherits:
-
Object
- Object
- IbRubyProxy::Server::IbWrapperAdapter
- Extended by:
- Util::StringUtils
- Includes:
- DRb::DRbObservable, EWrapper, Util::HasLogger
- Defined in:
- lib/ib_ruby_proxy/server/ib_wrapper_adapter.rb
Overview
Ruby representation of the IB EWrapper
class. It delegates received callbacks by triggering an observer notification. It will translate the name of the java method to Ruby (underscore), as well as translate the parameters from IB to the Ruby world.
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#signal ⇒ Object
readonly
Returns the value of attribute signal.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ IbWrapperAdapter
constructor
A new instance of IbWrapperAdapter.
Methods included from Util::StringUtils
Methods included from Util::HasLogger
Constructor Details
#initialize ⇒ IbWrapperAdapter
Returns a new instance of IbWrapperAdapter.
20 21 22 23 |
# File 'lib/ib_ruby_proxy/server/ib_wrapper_adapter.rb', line 20 def initialize @signal = EJavaSignal.new @client = EClientSocket.new(self, @signal) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
18 19 20 |
# File 'lib/ib_ruby_proxy/server/ib_wrapper_adapter.rb', line 18 def client @client end |
#signal ⇒ Object (readonly)
Returns the value of attribute signal.
18 19 20 |
# File 'lib/ib_ruby_proxy/server/ib_wrapper_adapter.rb', line 18 def signal @signal end |
Class Method Details
.define_ruby_method_for(java_method) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ib_ruby_proxy/server/ib_wrapper_adapter.rb', line 26 def self.define_ruby_method_for(java_method) ruby_method_name = to_underscore(java_method.name) class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{java_method.name}(*arguments) ruby_arguments = arguments.collect(&:to_ruby) if count_observers > 0 changed notify_observers *(["#{ruby_method_name}"] + ruby_arguments) else logger.debug "Received #{ruby_method_name}" logger.debug ruby_arguments.inspect end end RUBY end |