Class: Inspec::Resources::RabbitmqConfig

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

Instance Method Summary collapse

Methods included from FileReader

#read_file_content

Constructor Details

#initialize(conf_path = nil) ⇒ RabbitmqConfig

Returns a new instance of RabbitmqConfig.



20
21
22
23
# File 'lib/inspec/resources/rabbitmq_config.rb', line 20

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



25
26
27
28
29
# File 'lib/inspec/resources/rabbitmq_config.rb', line 25

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

#resource_idObject



35
36
37
# File 'lib/inspec/resources/rabbitmq_config.rb', line 35

def resource_id
  @conf_path
end

#to_sObject



31
32
33
# File 'lib/inspec/resources/rabbitmq_config.rb', line 31

def to_s
  "rabbitmq_config #{@conf_path}"
end