Class: Proc

Inherits:
Object show all
Defined in:
lib/fqdn_facts/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#call_with_vars(vars, *args) ⇒ Object



87
88
89
90
91
92
93
94
# File 'lib/fqdn_facts/core_ext.rb', line 87

def call_with_vars(vars, *args)
  Struct.new(*vars.keys).new(*vars.values).instance_exec(*args, &self)
rescue NameError
  # don't error out - just warn
  file, line = $!.backtrace.first.split(':')
  name = $!.message.split(/[`']/)[1]
  warn "Couldn't find value for key '#{name}' at #{file}:#{line}"
end