Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/ki/utils/extra_ruby.rb

Instance Method Summary collapse

Instance Method Details

#present?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/ki/utils/extra_ruby.rb', line 38

def present?
  !nil? && !empty?
end

#stringify_idsObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ki/utils/extra_ruby.rb', line 24

def stringify_ids
  collect do |e|
    if e['_id']
      e['id'] = e['_id'].to_s
      e.delete('_id')
    end
    if e[:_id]
      e['id'] = e[:_id].to_s
      e.delete(:_id)
    end
    e
  end
end