Class: IseshimaStore::Relation

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable, QueryMethods
Defined in:
lib/iseshima_store/relation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from QueryMethods

#all, #exists?, #find, #find_by, #inspect, #parent, #to_a, #where, #where!

Constructor Details

#initialize(klass) ⇒ Relation

Returns a new instance of Relation.



13
14
15
16
# File 'lib/iseshima_store/relation.rb', line 13

def initialize(klass)
  @klass = klass
  @where_clause = IseshimaStore::WhereClause.new(@klass)
end

Instance Attribute Details

#where_clauseObject

Returns the value of attribute where_clause.



10
11
12
# File 'lib/iseshima_store/relation.rb', line 10

def where_clause
  @where_clause
end

Instance Method Details

#eachObject



22
23
24
# File 'lib/iseshima_store/relation.rb', line 22

def each
  to_a.each { |obj| yield obj }
end

#spawnObject



18
19
20
# File 'lib/iseshima_store/relation.rb', line 18

def spawn
  clone
end