Class: Socket::Option
- Inherits:
-
Object
- Object
- Socket::Option
- Defined in:
- mrbgems/mruby-socket/mrblib/socket.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
def self.linger(family, level, optname, integer) end.
-
#family ⇒ Object
readonly
def self.linger(family, level, optname, integer) end.
-
#level ⇒ Object
readonly
def self.linger(family, level, optname, integer) end.
-
#optname ⇒ Object
readonly
def self.linger(family, level, optname, integer) end.
Class Method Summary collapse
Instance Method Summary collapse
-
#bool ⇒ Object
-
#initialize(family, level, optname, data) ⇒ Option
constructor
A new instance of Option.
-
#inspect ⇒ Object
-
#int ⇒ Object
-
#linger ⇒ Object
-
#unpack(template) ⇒ Object
Constructor Details
#initialize(family, level, optname, data) ⇒ Option
Returns a new instance of Option
579 580 581 582 583 584 |
# File 'mrbgems/mruby-socket/mrblib/socket.rb', line 579 def initialize(family, level, optname, data) @family = family @level = level @optname = optname @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
def self.linger(family, level, optname, integer) end
597 598 599 |
# File 'mrbgems/mruby-socket/mrblib/socket.rb', line 597 def data @data end |
#family ⇒ Object (readonly)
def self.linger(family, level, optname, integer) end
597 598 599 |
# File 'mrbgems/mruby-socket/mrblib/socket.rb', line 597 def family @family end |
#level ⇒ Object (readonly)
def self.linger(family, level, optname, integer) end
597 598 599 |
# File 'mrbgems/mruby-socket/mrblib/socket.rb', line 597 def level @level end |
#optname ⇒ Object (readonly)
def self.linger(family, level, optname, integer) end
597 598 599 |
# File 'mrbgems/mruby-socket/mrblib/socket.rb', line 597 def optname @optname end |
Class Method Details
.bool(family, level, optname, bool) ⇒ Object
586 587 588 |
# File 'mrbgems/mruby-socket/mrblib/socket.rb', line 586 def self.bool(family, level, optname, bool) self.new(family, level, optname, [(bool ? 1 : 0)].pack('i')) end |
.int(family, level, optname, integer) ⇒ Object
590 591 592 |
# File 'mrbgems/mruby-socket/mrblib/socket.rb', line 590 def self.int(family, level, optname, integer) self.new(family, level, optname, [integer].pack('i')) end |
Instance Method Details
#bool ⇒ Object
599 600 601 |
# File 'mrbgems/mruby-socket/mrblib/socket.rb', line 599 def bool @data.unpack('i')[0] != 0 end |
#inspect ⇒ Object
603 604 605 |
# File 'mrbgems/mruby-socket/mrblib/socket.rb', line 603 def inspect "#<Socket::Option: family:#{@family} level:#{@level} optname:#{@optname} #{@data.inspect}>" end |
#int ⇒ Object
607 608 609 |
# File 'mrbgems/mruby-socket/mrblib/socket.rb', line 607 def int @data.unpack('i')[0] end |
#linger ⇒ Object
611 612 613 |
# File 'mrbgems/mruby-socket/mrblib/socket.rb', line 611 def linger raise NotImplementedError.new end |
#unpack(template) ⇒ Object
615 616 617 |
# File 'mrbgems/mruby-socket/mrblib/socket.rb', line 615 def unpack(template) raise NotImplementedError.new end |