Module: PlainModel::Querying::Base

Extended by:
ActiveSupport::Concern
Included in:
PlainModel::QueryBuilder
Defined in:
lib/plain_model/querying/base.rb

Instance Method Summary collapse

Instance Method Details

#_recordsObject

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/plain_model/querying/base.rb', line 44

def _records
  raise NotImplementedError, "implement #_records private method in #{self.class}"
end

#dupObject



34
35
36
37
38
# File 'lib/plain_model/querying/base.rb', line 34

def dup
  new_instance = self.class.new(*dup_args)
  new_instance.values = values.dup
  new_instance
end

#dup_argsObject



40
41
42
# File 'lib/plain_model/querying/base.rb', line 40

def dup_args
  []
end

#initial_valuesObject



24
25
26
# File 'lib/plain_model/querying/base.rb', line 24

def initial_values
  {}
end

#initialize(*args) ⇒ Object



19
20
21
22
# File 'lib/plain_model/querying/base.rb', line 19

def initialize(*args)
  @values = initial_values
  super(*args)
end

#to_aObject



28
29
30
31
32
# File 'lib/plain_model/querying/base.rb', line 28

def to_a
  return @to_a if defined?(@to_a)

  @to_a = _records
end