Method: BlueprintConfig::Configuration#process_erb

Defined in:
lib/blueprint_config/configuration.rb

#process_erb(object) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/blueprint_config/configuration.rb', line 47

def process_erb(object)
  case object
  when String
    if object.start_with?('<%=') && object.end_with?('%>')
      ERB.new(object).result(binding)
    else
      object
    end
  when OptionsArray
    object.each_with_index { |o, index| object[index] = process_erb(o) }
  when OptionsHash
    object.each { |k, v| object[k] = process_erb(v) }
  else
    object
  end
end