Class: Citrus::Components::Connection

Inherits:
Component
  • Object
show all
Defined in:
lib/citrus/components/connection.rb

Overview

Connection

Constant Summary collapse

DELEGATED_METHODS =
[
  :add_logined_user,
  :increase_conn_count,
  :remove_logined_user,
  :decrease_conn_count,
  :get_statistics_info
]

Instance Method Summary collapse

Constructor Details

#initialize(app, args = {}) ⇒ Connection

Initialize the component

Parameters:

  • app (Object)
  • args (Hash) (defaults to: {})


31
32
33
34
# File 'lib/citrus/components/connection.rb', line 31

def initialize app, args={}
  @app = app
  @service = Common::Service::ConnectionService.new app
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object

Proxy for connection service

Parameters:

  • name (String)


39
40
41
42
43
44
45
# File 'lib/citrus/components/connection.rb', line 39

def method_missing name, *args
  if DELEGATED_METHODS.include? name
    @service.send name, *args
  else
    super
  end
end