Class: Grat::HashBinding
- Inherits:
-
Object
- Object
- Grat::HashBinding
- Defined in:
- lib/grat/hash_binding.rb
Overview
A class to assist in turning a hash into a binding (for erb rendering)
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
Instance Method Summary collapse
- #get_binding ⇒ Object
-
#initialize(hsh) ⇒ HashBinding
constructor
A new instance of HashBinding.
- #method_missing(meth, *args) ⇒ Object
Constructor Details
#initialize(hsh) ⇒ HashBinding
Returns a new instance of HashBinding.
6 7 8 |
# File 'lib/grat/hash_binding.rb', line 6 def initialize(hsh) self.hash = hsh end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
14 15 16 |
# File 'lib/grat/hash_binding.rb', line 14 def method_missing(meth,*args) hash[meth] end |
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash.
4 5 6 |
# File 'lib/grat/hash_binding.rb', line 4 def hash @hash end |
Instance Method Details
#get_binding ⇒ Object
10 11 12 |
# File 'lib/grat/hash_binding.rb', line 10 def get_binding binding end |