Class: Feet::View
Instance Method Summary collapse
- #call ⇒ Object
-
#h(str) ⇒ Object
Helper method for View.
- #init_vars(received_vars) ⇒ Object
-
#initialize(template, instance_hash) ⇒ View
constructor
A new instance of View.
Constructor Details
#initialize(template, instance_hash) ⇒ View
Returns a new instance of View.
5 6 7 8 |
# File 'lib/feet/view.rb', line 5 def initialize(template, instance_hash) @template = template init_vars(instance_hash) end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 |
# File 'lib/feet/view.rb', line 10 def call eruby = Erubis::Eruby.new(@template) # Locals here are in addition to instance variables, if any eval eruby.src end |
#h(str) ⇒ Object
Helper method for View
24 25 26 |
# File 'lib/feet/view.rb', line 24 def h(str) URI.escape str end |
#init_vars(received_vars) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/feet/view.rb', line 16 def init_vars(received_vars) received_vars.each do |key, value| # key example = '@quote' instance_variable_set(key, value) end end |