Class: RubySL::Socket::Foreign::Linger
- Inherits:
-
Rubinius::FFI::Struct
- Object
- Rubinius::FFI::Struct
- RubySL::Socket::Foreign::Linger
- Defined in:
- lib/rubysl/socket/foreign/linger.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_string(string) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/rubysl/socket/foreign/linger.rb', line 7 def self.from_string(string) linger = new linger.pointer.write_string(string, string.bytesize) linger end |
Instance Method Details
#linger ⇒ Object
19 20 21 |
# File 'lib/rubysl/socket/foreign/linger.rb', line 19 def linger self[:l_linger].to_i end |
#linger=(value) ⇒ Object
31 32 33 |
# File 'lib/rubysl/socket/foreign/linger.rb', line 31 def linger=(value) self[:l_linger] = value end |
#on_off ⇒ Object
15 16 17 |
# File 'lib/rubysl/socket/foreign/linger.rb', line 15 def on_off self[:l_onoff] end |
#on_off=(value) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/rubysl/socket/foreign/linger.rb', line 23 def on_off=(value) if value.is_a?(Integer) self[:l_onoff] = value else self[:l_onoff] = value ? 1 : 0 end end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/rubysl/socket/foreign/linger.rb', line 35 def to_s pointer.read_string(pointer.total) end |