Method: EacRubyUtils::CustomFormat::String#source_object_value

Defined in:
lib/eac_ruby_utils/custom_format.rb

#source_object_value(object, method) ⇒ Object

Raises:

  • (::ArgumentError)


37
38
39
40
41
42
# File 'lib/eac_ruby_utils/custom_format.rb', line 37

def source_object_value(object, method)
  return object.send(method) if object.respond_to?(method)
  return object[method] if object.respond_to?('[]')

  raise ::ArgumentError, "Methods \"#{method}\" or \"[]\" not found for #{object}"
end