Method: Cornucopia::Util::ConfiguredReport#get_instance_variable

Defined in:
lib/cornucopia/util/configured_report.rb

#get_instance_variable(the_object, instance_variable, variable_name) ⇒ Object



544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
# File 'lib/cornucopia/util/configured_report.rb', line 544

def get_instance_variable(the_object, instance_variable, variable_name)
  fetched = false

  if the_object.respond_to?(variable_name)
    begin
      return_value = the_object.send(variable_name)
      fetched      = true
    rescue
    end
  end

  unless fetched
    return_value = the_object.instance_variable_get(instance_variable)
  end

  return_value
end