Class: Inspec::Resources::PConfig
- Inherits:
-
Object
- Object
- Inspec::Resources::PConfig
- Includes:
- FileReader
- Defined in:
- lib/inspec/resources/parse_config.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Instance Method Summary collapse
-
#initialize(content = nil, useropts = nil) ⇒ PConfig
constructor
A new instance of PConfig.
- #method_missing(name) ⇒ Object
- #params(*opts) ⇒ Object
- #to_s ⇒ Object
Methods included from FileReader
Constructor Details
#initialize(content = nil, useropts = nil) ⇒ PConfig
Returns a new instance of PConfig.
49 50 51 52 53 54 55 56 |
# File 'lib/inspec/resources/parse_config.rb', line 49 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
58 59 60 |
# File 'lib/inspec/resources/parse_config.rb', line 58 def method_missing(name) read_params[name.to_s] end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
48 49 50 |
# File 'lib/inspec/resources/parse_config.rb', line 48 def content @content end |
Instance Method Details
#params(*opts) ⇒ Object
62 63 64 65 66 |
# File 'lib/inspec/resources/parse_config.rb', line 62 def params(*opts) opts.inject(read_params) do |res, nxt| res.respond_to?(:key) ? res[nxt] : nil end end |
#to_s ⇒ Object
68 69 70 |
# File 'lib/inspec/resources/parse_config.rb', line 68 def to_s "Parse Config #{@conf_path}" end |