Class: Quark::Quark::Mock::MockSocket
- Inherits:
-
DatawireQuarkCore::QuarkObject
- Object
- DatawireQuarkCore::QuarkObject
- Quark::Quark::Mock::MockSocket
- Extended by:
- DatawireQuarkCore::Static
- Defined in:
- lib/quark/mock.rb
Constant Summary
Constants included from DatawireQuarkCore::Static
DatawireQuarkCore::Static::Unassigned
Instance Attribute Summary collapse
-
#closed ⇒ Object
Returns the value of attribute closed.
-
#handler ⇒ Object
Returns the value of attribute handler.
-
#messages ⇒ Object
Returns the value of attribute messages.
Instance Method Summary collapse
- #__init_fields__ ⇒ Object
- #_getClass ⇒ Object
- #_getField(name) ⇒ Object
- #_setField(name, value) ⇒ Object
- #close ⇒ Object
-
#initialize(handler) ⇒ MockSocket
constructor
A new instance of MockSocket.
- #send(message) ⇒ Object
- #sendBinary(bytes) ⇒ Object
Methods included from DatawireQuarkCore::Static
_lazy_statics, static, unlazy_statics
Methods inherited from DatawireQuarkCore::QuarkObject
Constructor Details
#initialize(handler) ⇒ MockSocket
Returns a new instance of MockSocket.
446 447 448 449 450 451 452 453 454 455 456 |
# File 'lib/quark/mock.rb', line 446 def initialize(handler) self.__init_fields__ (self).handler = handler (self).closed = false (self). = ::DatawireQuarkCore::List.new([]) handler.onWSInit(self) handler.onWSConnected(self) nil end |
Instance Attribute Details
#closed ⇒ Object
Returns the value of attribute closed.
438 439 440 |
# File 'lib/quark/mock.rb', line 438 def closed @closed end |
#handler ⇒ Object
Returns the value of attribute handler.
438 439 440 |
# File 'lib/quark/mock.rb', line 438 def handler @handler end |
#messages ⇒ Object
Returns the value of attribute messages.
438 439 440 |
# File 'lib/quark/mock.rb', line 438 def @messages end |
Instance Method Details
#__init_fields__ ⇒ Object
529 530 531 532 533 534 535 536 |
# File 'lib/quark/mock.rb', line 529 def __init_fields__() self. = ::DatawireQuarkCore::List.new([]) self.closed = false self.handler = nil nil end |
#_getClass ⇒ Object
491 492 493 494 495 496 |
# File 'lib/quark/mock.rb', line 491 def _getClass() return "quark.mock.MockSocket" nil end |
#_getField(name) ⇒ Object
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
# File 'lib/quark/mock.rb', line 498 def _getField(name) if ((name) == ("messages")) return (self). end if ((name) == ("closed")) return (self).closed end if ((name) == ("handler")) return (self).handler end return nil nil end |
#_setField(name, value) ⇒ Object
514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
# File 'lib/quark/mock.rb', line 514 def _setField(name, value) if ((name) == ("messages")) (self). = ::DatawireQuarkCore.cast(value) { ::DatawireQuarkCore::List } end if ((name) == ("closed")) (self).closed = ::DatawireQuarkCore.cast(value) { ::Object } end if ((name) == ("handler")) (self).handler = ::DatawireQuarkCore.cast(value) { ::Quark.quark.WSHandler } end nil end |
#close ⇒ Object
477 478 479 480 481 482 483 484 485 486 487 488 489 |
# File 'lib/quark/mock.rb', line 477 def close() if (@closed) ::Quark.quark.concurrent.Context.runtime().fail("already closed") else @handler.onWSClosed(self) @handler.onWSFinal(self) @closed = true end return true nil end |