Module: PlainModel::Querying::Base
- Extended by:
- ActiveSupport::Concern
- Included in:
- PlainModel::QueryBuilder
- Defined in:
- lib/plain_model/querying/base.rb
Instance Method Summary collapse
- #_records ⇒ Object
- #_within_new_instance(&block) ⇒ Object
- #dup ⇒ Object
- #dup_args ⇒ Object
- #to_a ⇒ Object
Instance Method Details
#_records ⇒ Object
56 57 58 |
# File 'lib/plain_model/querying/base.rb', line 56 def _records raise NotImplementedError, "implement #_records private method in #{self.class}" end |
#_within_new_instance(&block) ⇒ Object
50 51 52 53 54 |
# File 'lib/plain_model/querying/base.rb', line 50 def _within_new_instance(&block) new_instance = dup new_instance.instance_exec(&block) new_instance end |
#dup ⇒ Object
40 41 42 43 44 |
# File 'lib/plain_model/querying/base.rb', line 40 def dup new_instance = self.class.new(*dup_args) new_instance.values = values.dup new_instance end |
#dup_args ⇒ Object
46 47 48 |
# File 'lib/plain_model/querying/base.rb', line 46 def dup_args [] end |
#to_a ⇒ Object
34 35 36 37 38 |
# File 'lib/plain_model/querying/base.rb', line 34 def to_a return @to_a if defined?(@to_a) @to_a = _records end |