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 Style/AccessorMethodName.
-
#initialize(vars = {}) ⇒ HashBinding
constructor
A new instance of HashBinding.
- #method_missing(name) ⇒ Object
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
13 14 15 16 |
# File 'lib/epuber/vendor/hash_binding.rb', line 13 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 Style/AccessorMethodName
20 21 22 |
# File 'lib/epuber/vendor/hash_binding.rb', line 20 def get_binding binding end |