Class: RabbitMQHttpAuthBackend::Config::Runtime

Inherits:
Object
  • Object
show all
Defined in:
lib/rabbitmq_http_auth_backend/config/runtime.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = nil, key = nil) ⇒ Runtime

Returns a new instance of Runtime.



8
9
10
11
12
# File 'lib/rabbitmq_http_auth_backend/config/runtime.rb', line 8

def initialize(config = nil, key = nil)
  @configuration =
    config || RabbitMQHttpAuthBackend::Config.default_configuration
  @key = key
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



6
7
8
# File 'lib/rabbitmq_http_auth_backend/config/runtime.rb', line 6

def configuration
  @configuration
end

Instance Method Details

#http_method(method) ⇒ Object



14
15
16
# File 'lib/rabbitmq_http_auth_backend/config/runtime.rb', line 14

def http_method(method)
  configuration[:http_method] = method.to_s.downcase.to_sym
end

#path(path) ⇒ Object



34
35
36
# File 'lib/rabbitmq_http_auth_backend/config/runtime.rb', line 34

def path(path)
  configuration["#{key}_path".to_sym] = path
end

#resolver(resolver = nil, &block) ⇒ Object



38
39
40
# File 'lib/rabbitmq_http_auth_backend/config/runtime.rb', line 38

def resolver(resolver = nil, &block)
  configuration["#{key}_resolver".to_sym] = resolver || block
end

#resource(&block) ⇒ Object



26
27
28
# File 'lib/rabbitmq_http_auth_backend/config/runtime.rb', line 26

def resource(&block)
  self.class.new(configuration, :resource).instance_eval(&block)
end

#topic(&block) ⇒ Object



30
31
32
# File 'lib/rabbitmq_http_auth_backend/config/runtime.rb', line 30

def topic(&block)
  self.class.new(configuration, :topic).instance_eval(&block)
end

#user(&block) ⇒ Object



18
19
20
# File 'lib/rabbitmq_http_auth_backend/config/runtime.rb', line 18

def user(&block)
  self.class.new(configuration, :user).instance_eval(&block)
end

#vhost(&block) ⇒ Object



22
23
24
# File 'lib/rabbitmq_http_auth_backend/config/runtime.rb', line 22

def vhost(&block)
  self.class.new(configuration, :vhost).instance_eval(&block)
end