Class: CommonMob::Erb::Context
- Inherits:
-
Object
- Object
- CommonMob::Erb::Context
- Defined in:
- lib/common_mob/erb.rb
Instance Method Summary collapse
- #convert_value(value) ⇒ Object
- #get_binding ⇒ Object
-
#initialize(hash) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(hash) ⇒ Context
Returns a new instance of Context.
6 7 8 9 10 |
# File 'lib/common_mob/erb.rb', line 6 def initialize(hash) hash.each do |k,v| instance_variable_set("@#{k}", convert_value(v)) end end |
Instance Method Details
#convert_value(value) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/common_mob/erb.rb', line 12 def convert_value(value) case value when AngryHash value when Hash AngryHash[value] else value end end |
#get_binding ⇒ Object
23 24 25 |
# File 'lib/common_mob/erb.rb', line 23 def get_binding binding end |