Class: Sip2::Connection

Inherits:
Object
  • Object
show all
Includes:
Messages::Login, Messages::PatronInformation
Defined in:
lib/sip2/connection.rb

Overview

Sip2 Connection

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Messages::PatronInformation

included

Methods included from Messages::Login

included

Constructor Details

#initialize(socket, ignore_error_detection) ⇒ Connection

Returns a new instance of Connection.



19
20
21
22
23
# File 'lib/sip2/connection.rb', line 19

def initialize(socket, ignore_error_detection)
  @socket = socket
  @ignore_error_detection = ignore_error_detection
  @sequence = 1
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/sip2/connection.rb', line 25

def method_missing(method_name, *args)
  if Connection.connection_modules.include?(method_name.to_sym)
    send_and_handle_message(method_name, *args)
  else
    super
  end
end

Class Attribute Details

.connection_modulesObject (readonly)

Returns the value of attribute connection_modules.



9
10
11
# File 'lib/sip2/connection.rb', line 9

def connection_modules
  @connection_modules
end

Class Method Details

.add_connection_module(module_name) ⇒ Object



11
12
13
# File 'lib/sip2/connection.rb', line 11

def add_connection_module(module_name)
  @connection_modules << module_name
end

Instance Method Details

#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/sip2/connection.rb', line 33

def respond_to_missing?(method_name, _include_private = false)
  Connection.connection_modules.include?(method_name.to_sym) || super
end