Class: GLCommand::ContextInspect

Inherits:
Object
  • Object
show all
Defined in:
lib/gl_command/context_inspect.rb

Class Method Summary collapse

Class Method Details

.error(error_obj) ⇒ Object



3
4
5
6
7
# File 'lib/gl_command/context_inspect.rb', line 3

def self.error(error_obj)
  return '' if error_obj.blank?

  error_obj.is_a?(Array) ? error_obj.uniq.join(', ') : error_obj.to_s
end

.hash_params(hash) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/gl_command/context_inspect.rb', line 9

def self.hash_params(hash)
  hash.map do |key, value|
    value_s =
      if value.nil?
        'nil'
      elsif value.respond_to?(:to_sql)
        object_param_as_sql(value)
      elsif value.respond_to?(:uuid)
        object_param_with_id(value, :uuid)
      elsif value.respond_to?(:id)
        object_param_with_id(value, :id)
      else
        value
      end
    "#{key}: #{value_s}"
  end.join(', ')
end