Class: RabbitMQHttpAuthBackend::Config

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

Defined Under Namespace

Classes: Runtime

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version = DEFAULT_CFG_KEY) ⇒ Config

Returns a new instance of Config.



55
56
57
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 55

def initialize(version = DEFAULT_CFG_KEY)
  @version = version.to_sym
end

Instance Attribute Details

#versionObject (readonly)

Returns the value of attribute version.



53
54
55
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 53

def version
  @version
end

Class Method Details

.configurationObject



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

def self.configuration
  @configuration ||= { default_configuration_key => default_configuration }
end

.default_configurationObject



43
44
45
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 43

def self.default_configuration
  {}.merge(DEFAULT_VALUES)
end

.default_configuration_keyObject



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

def self.default_configuration_key
  DEFAULT_CFG_KEY
end

.reset!Object



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

def self.reset!
  @configuration = { default_configuration_key => default_configuration }
end

.version(version) ⇒ Object



47
48
49
50
51
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 47

def self.version(version)
  return unless versions.include?(version)

  new(version)
end

.versionsObject



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

def self.versions
  configuration.keys
end

Instance Method Details

#fetch(resource, element) ⇒ Object



95
96
97
98
99
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 95

def fetch(resource, element)
  method = "#{resource}_#{element}".to_sym
  return nil unless respond_to?(method)
  public_send(method)
end

#http_methodObject



59
60
61
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 59

def http_method
  data[:http_method]
end

#resource_pathObject



79
80
81
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 79

def resource_path
  sanitize_path(data[:resource_path])
end

#resource_resolverObject



83
84
85
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 83

def resource_resolver
  data[:resource_resolver]
end

#topic_pathObject



87
88
89
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 87

def topic_path
  sanitize_path(data[:topic_path])
end

#topic_resolverObject



91
92
93
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 91

def topic_resolver
  data[:topic_resolver]
end

#user_pathObject



63
64
65
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 63

def user_path
  sanitize_path(data[:user_path])
end

#user_resolverObject



67
68
69
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 67

def user_resolver
  data[:user_resolver]
end

#vhost_pathObject



71
72
73
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 71

def vhost_path
  sanitize_path(data[:vhost_path])
end

#vhost_resolverObject



75
76
77
# File 'lib/rabbitmq_http_auth_backend/config.rb', line 75

def vhost_resolver
  data[:vhost_resolver]
end