Class: IB::IBSocket
- Inherits:
-
TCPSocket
- Object
- TCPSocket
- IB::IBSocket
- Defined in:
- lib/ib-ruby/ib.rb
Overview
logger = Logger.new(STDERR)
Instance Method Summary collapse
- #read_boolean ⇒ Object
-
#read_decimal ⇒ Object
Floating-point numbers shouldn’t be used to store money.
- #read_int ⇒ Object
- #read_string ⇒ Object
-
#send(data) ⇒ Object
send nice null terminated binary data.
Instance Method Details
#read_boolean ⇒ Object
57 58 59 |
# File 'lib/ib-ruby/ib.rb', line 57 def read_boolean self.read_string.to_i != 0 end |
#read_decimal ⇒ Object
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_int ⇒ Object
53 54 55 |
# File 'lib/ib-ruby/ib.rb', line 53 def read_int self.read_string.to_i end |
#read_string ⇒ Object
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 |