Class: Inspec::Resources::PConfig
- Inherits:
-
Object
- Object
- Inspec::Resources::PConfig
show all
- Defined in:
- lib/resources/parse_config.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(content = nil, useropts = nil) ⇒ PConfig
45
46
47
48
49
50
51
52
|
# File 'lib/resources/parse_config.rb', line 45
def initialize(content = nil, useropts = nil)
@opts = {}
@opts = useropts.dup unless useropts.nil?
@files_contents = {}
@content = content
read_params unless @content.nil?
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
54
55
56
|
# File 'lib/resources/parse_config.rb', line 54
def method_missing(name)
read_params[name.to_s]
end
|
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
44
45
46
|
# File 'lib/resources/parse_config.rb', line 44
def content
@content
end
|
Instance Method Details
#params(*opts) ⇒ Object
58
59
60
61
62
|
# File 'lib/resources/parse_config.rb', line 58
def params(*opts)
opts.inject(read_params) do |res, nxt|
res.respond_to?(:key) ? res[nxt] : nil
end
end
|
#to_s ⇒ Object
64
65
66
|
# File 'lib/resources/parse_config.rb', line 64
def to_s
"Parse Config #{@conf_path}"
end
|