Class: FakeWeb::SocketDelegator

Inherits:
Object
  • Object
show all
Defined in:
lib/fake_web/socket_delegator.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(delegate = nil) ⇒ SocketDelegator

Returns a new instance of SocketDelegator.



4
5
6
# File 'lib/fake_web/socket_delegator.rb', line 4

def initialize(delegate=nil)
  @delegate = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/fake_web/socket_delegator.rb', line 8

def method_missing(method, *args, &block)
  if @delegate
    @delegate.send(method, *args, &block)
  else
    self.send("my_#{method}", *args, &block)
  end
end

Instance Method Details

#my_closed?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/fake_web/socket_delegator.rb', line 16

def my_closed?
  @closed ||= true
end

#my_readuntil(*args) ⇒ Object



20
21
# File 'lib/fake_web/socket_delegator.rb', line 20

def my_readuntil(*args)
end