Class: IB::IBSocket

Inherits:
TCPSocket
  • Object
show all
Defined in:
lib/ib-ruby/ib.rb

Overview

logger = Logger.new(STDERR)

Instance Method Summary collapse

Instance Method Details

#read_booleanObject



57
58
59
# File 'lib/ib-ruby/ib.rb', line 57

def read_boolean
  self.read_string.to_i != 0
end

#read_decimalObject

Floating-point numbers shouldn’t be used to store money.



62
63
64
# File 'lib/ib-ruby/ib.rb', line 62

def read_decimal
  self.read_string.to_d
end

#read_intObject



53
54
55
# File 'lib/ib-ruby/ib.rb', line 53

def read_int
  self.read_string.to_i
end

#read_stringObject



49
50
51
# File 'lib/ib-ruby/ib.rb', line 49

def read_string
  self.gets("\0").chop
end

#send(data) ⇒ Object

send nice null terminated binary data



45
46
47
# File 'lib/ib-ruby/ib.rb', line 45

def send(data)
  self.syswrite(data.to_s + "\0")
end