Module: Dynomite::Item::Query::Relation::Ids

Included in:
Dynomite::Item::Query::Relation
Defined in:
lib/dynomite/item/query/relation/ids.rb

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Surprisingly, Enumberable does not provide empty?

Returns:

  • (Boolean)


17
18
19
# File 'lib/dynomite/item/query/relation/ids.rb', line 17

def empty?
  !exists?
end

#exists?(args = {}) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/dynomite/item/query/relation/ids.rb', line 12

def exists?(args={})
  !!limit(1).first
end

#idsObject



8
9
10
# File 'lib/dynomite/item/query/relation/ids.rb', line 8

def ids
  project(:id).each.map(&:id).to_a
end

#pluck(*names) ⇒ Object



3
4
5
6
# File 'lib/dynomite/item/query/relation/ids.rb', line 3

def pluck(*names)
  project(*names)
  super # provided by Ruby Enumerable
end