Class: Redom::Connection::Sender

Inherits:
Object
  • Object
show all
Defined in:
lib/redom/connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(conn, async = false) ⇒ Sender

Returns a new instance of Sender.



6
7
8
9
# File 'lib/redom/connection.rb', line 6

def initialize(conn, async = false)
  @conn = conn
  @async = async
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &blck) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/redom/connection.rb', line 11

def method_missing(name, *args, &blck)
  if @async
    @conn._dispatcher.run_task(@conn, name, args, blck)
    nil
  else
    result = @conn.send(name, *args, &blck)
    @conn.sync{}
    result
  end
end