Class: Interface::Queryable

Inherits:
Object
  • Object
show all
Defined in:
lib/Olib/interface/queryable.rb

Direct Known Subclasses

Creatures

Class Method Summary collapse

Class Method Details

.each(&block) ⇒ Object


7
8
9
# File 'lib/Olib/interface/queryable.rb', line 7

def self.each(&block)
  fetch.each &block
end

.empty?Boolean

Returns:

  • (Boolean)

42
43
44
# File 'lib/Olib/interface/queryable.rb', line 42

def self.empty?
  (fetch || []).empty?
end

.fetchObject


3
4
5
# File 'lib/Olib/interface/queryable.rb', line 3

def self.fetch
  []
end

.find(&block) ⇒ Object


15
16
17
# File 'lib/Olib/interface/queryable.rb', line 15

def self.find(&block)
  fetch.find &block
end

.firstObject


34
35
36
# File 'lib/Olib/interface/queryable.rb', line 34

def self.first
  fetch.first
end

.map(&block) ⇒ Object


11
12
13
# File 'lib/Olib/interface/queryable.rb', line 11

def self.map(&block)
  fetch.map &block
end

.reject(&block) ⇒ Object


27
28
29
# File 'lib/Olib/interface/queryable.rb', line 27

def self.reject(&block)
  fetch.reject &block
end

.sample(n = 1) ⇒ Object


38
39
40
# File 'lib/Olib/interface/queryable.rb', line 38

def self.sample(n = 1)
  fetch.sample n
end

.select(&block) ⇒ Object


23
24
25
# File 'lib/Olib/interface/queryable.rb', line 23

def self.select(&block)
  fetch.select &block
end

.sizeObject


46
47
48
# File 'lib/Olib/interface/queryable.rb', line 46

def self.size
  fetch.size
end

.sort(&block) ⇒ Object


19
20
21
# File 'lib/Olib/interface/queryable.rb', line 19

def self.sort(&block)
  fetch.sort &block
end

.where(**conds) ⇒ Object


31
32
# File 'lib/Olib/interface/queryable.rb', line 31

def self.where(**conds)
end