Class: Imports::Context
Constant Summary collapse
- KERNEL_METHODS_DELEGATED =
[:import, :require, :raise, :puts, :p]
Instance Attribute Summary collapse
-
#exports ⇒ Object
readonly
Returns the value of attribute exports.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path) ⇒ Context
constructor
A new instance of Context.
- #method_missing(name, *args, &block) ⇒ Object
- #respond_to_missing?(name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(path) ⇒ Context
Returns a new instance of Context.
84 85 86 |
# File 'lib/import.rb', line 84 def initialize(path) @exports = Export.new(path) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
94 95 96 97 |
# File 'lib/import.rb', line 94 def method_missing(name, *args, &block) super unless KERNEL_METHODS_DELEGATED.include? name ::Kernel.send(name, *args, &block) end |
Instance Attribute Details
#exports ⇒ Object (readonly)
Returns the value of attribute exports.
83 84 85 |
# File 'lib/import.rb', line 83 def exports @exports end |
Class Method Details
.const_missing(name) ⇒ Object
88 89 90 |
# File 'lib/import.rb', line 88 def self.const_missing(name) ::Object.const_get(name) end |
Instance Method Details
#respond_to_missing?(name, include_private = false) ⇒ Boolean
99 100 101 |
# File 'lib/import.rb', line 99 def respond_to_missing?(name, include_private = false) KERNEL_METHODS_DELEGATED.include?(name) or super end |