Class: OpenConfig::Base
- Inherits:
-
Object
- Object
- OpenConfig::Base
- Defined in:
- lib/open_config/files/base.rb
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
Instance Method Summary collapse
-
#initialize(root: Dir.pwd, file:) ⇒ Base
constructor
A new instance of Base.
- #method_missing(method_name, *arguments, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(root: Dir.pwd, file:) ⇒ Base
Returns a new instance of Base.
7 8 9 |
# File 'lib/open_config/files/base.rb', line 7 def initialize(root: Dir.pwd, file:) @file_path = File.join(root, file) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
11 12 13 14 15 |
# File 'lib/open_config/files/base.rb', line 11 def method_missing(method_name, *arguments, &block) return super unless configuration_method?(method_name) tree.public_send(method_name, *arguments, &block) end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
5 6 7 |
# File 'lib/open_config/files/base.rb', line 5 def file_path @file_path end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
17 18 19 |
# File 'lib/open_config/files/base.rb', line 17 def respond_to_missing?(method_name, include_private = false) configuration_method?(method_name) || super end |