Class: Epuber::HashBinding
- Inherits:
-
Object
- Object
- Epuber::HashBinding
- Defined in:
- lib/epuber/vendor/hash_binding.rb
Instance Method Summary collapse
-
#get_binding ⇒ Object
rubocop:disable Naming/AccessorMethodName.
-
#initialize(vars = {}) ⇒ HashBinding
constructor
A new instance of HashBinding.
- #method_missing(name) ⇒ Object
- #respond_to_missing?(name, _include_private = false) ⇒ Boolean
Constructor Details
#initialize(vars = {}) ⇒ HashBinding
Returns a new instance of HashBinding.
7 8 9 |
# File 'lib/epuber/vendor/hash_binding.rb', line 7 def initialize(vars = {}) @vars = vars end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
19 20 21 22 23 |
# File 'lib/epuber/vendor/hash_binding.rb', line 19 def method_missing(name) raise NameError, "Not found value for key #{name}" unless @vars.key?(name) @vars[name] end |
Instance Method Details
#get_binding ⇒ Object
rubocop:disable Naming/AccessorMethodName
27 28 29 |
# File 'lib/epuber/vendor/hash_binding.rb', line 27 def get_binding binding end |
#respond_to_missing?(name, _include_private = false) ⇒ Boolean
13 14 15 |
# File 'lib/epuber/vendor/hash_binding.rb', line 13 def respond_to_missing?(name, _include_private = false) @vars.key?(name) || super end |