Class: Inspec::Resources::RabbitmqConf

Inherits:
Object
  • Object
show all
Includes:
FileReader
Defined in:
lib/resources/rabbitmq_conf.rb

Instance Method Summary collapse

Methods included from FileReader

#read_file_content

Constructor Details

#initialize(conf_path = nil) ⇒ RabbitmqConf

Returns a new instance of RabbitmqConf.



21
22
23
24
# File 'lib/resources/rabbitmq_conf.rb', line 21

def initialize(conf_path = nil)
  @conf_path = conf_path || '/etc/rabbitmq/rabbitmq.config'
  @content = read_file_content(@conf_path, allow_empty: true)
end

Instance Method Details

#params(*opts) ⇒ Object



26
27
28
29
30
# File 'lib/resources/rabbitmq_conf.rb', line 26

def params(*opts)
  opts.inject(read_params) do |res, nxt|
    res.respond_to?(:key) ? res[nxt] : nil
  end
end

#to_sObject



32
33
34
# File 'lib/resources/rabbitmq_conf.rb', line 32

def to_s
  "rabbitmq_config #{@conf_path}"
end