Class: Wunderbar::BuilderBase

Inherits:
Object
  • Object
show all
Defined in:
lib/wunderbar/builder.rb

Direct Known Subclasses

BuilderClass, Channel, Overridable

Instance Method Summary collapse

Instance Method Details

#get_bindingObject



23
24
25
# File 'lib/wunderbar/builder.rb', line 23

def get_binding
  binding
end

#set_variables_from_params(locals = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/wunderbar/builder.rb', line 9

def set_variables_from_params(locals={})
  params = @_scope.params.map do |key, value|
    value = value.first if Array === value
    value.gsub! "\r\n", "\n" if String === value
    ["@#{key}", value]
  end

  Hash[params].merge(locals).each do |key,value|
    if key =~ /^@[a-z]\w+$/
      instance_variable_set key, value 
    end
  end
end