Class: Grat::HashBinding

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#hashObject

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_bindingObject



10
11
12
# File 'lib/grat/hash_binding.rb', line 10

def get_binding
  binding
end