Class: Superbolt::Connection::Base

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

Direct Known Subclasses

App, Queue

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, config = nil) ⇒ Base

Returns a new instance of Base.



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

def initialize(name, config=nil)
  @name = name
  @config = config || Superbolt.config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



4
5
6
# File 'lib/superbolt/connection/base.rb', line 4

def config
  @config
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/superbolt/connection/base.rb', line 4

def name
  @name
end

Class Method Details

.default_optionsObject



30
31
32
33
34
35
36
# File 'lib/superbolt/connection/base.rb', line 30

def self.default_options
  {
    :auto_delete => false,
    :durable => true,
    :exclusive => false
  }
end

Instance Method Details

#channelObject



26
27
28
# File 'lib/superbolt/connection/base.rb', line 26

def channel
  connection.channel
end

#closeObject

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/superbolt/connection/base.rb', line 15

def close
  raise NotImplementedError
end

#connectionObject

Raises:

  • (NotImplementedError)


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

def connection
  raise NotImplementedError
end

#qObject



19
20
21
# File 'lib/superbolt/connection/base.rb', line 19

def q
  @q ||= connection.queue(name, self.class.default_options)
end