Class: Veritas::Relation::Gateway
- Inherits:
-
Veritas::Relation
- Object
- Veritas::Relation
- Veritas::Relation::Gateway
- Defined in:
- lib/veritas/relation/gateway.rb
Overview
A relation backed by an adapter
Constant Summary collapse
- DECORATED_CLASS =
superclass
Instance Method Summary collapse
-
#difference(other) ⇒ Gateway, Algebra::Difference
Return the diferrence between relations.
-
#each {|tuple| ... } ⇒ self
Iterate over each row in the results.
-
#initialize(adapter, relation) ⇒ undefined
constructor
private
Initialize a Gateway.
-
#intersect(other) ⇒ Gateway, Algebra::Intersection
Return the intersection between relations.
-
#join(other) {|relation| ... } ⇒ Gateway, ...
Return a relation that is the join of two relations.
-
#product(other) ⇒ Gateway, Algebra::Product
Return a relation that is the cartesian product of two relations.
-
#respond_to?(method) ⇒ Boolean
private
Test if the method is supported on this object.
-
#summarize(summarize_with = TABLE_DEE) {|function| ... } ⇒ Gateway, Algebra::Summarization
Return a summarized relation.
-
#union(other) ⇒ Gateway, Algebra::Union
Return the union between relations.
Constructor Details
#initialize(adapter, relation) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a Gateway
40 41 42 43 |
# File 'lib/veritas/relation/gateway.rb', line 40 def initialize(adapter, relation) @adapter = adapter @relation = relation end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ self, Object (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Proxy the message to the relation
243 244 245 |
# File 'lib/veritas/relation/gateway.rb', line 243 def method_missing(method, *args, &block) forwardable?(method) ? forward(method, *args, &block) : super end |
Instance Method Details
#difference(other) ⇒ Gateway, Algebra::Difference
Return the diferrence between relations
170 171 172 |
# File 'lib/veritas/relation/gateway.rb', line 170 def difference(other) binary_operation(__method__, other, Algebra::Difference) end |
#each {|tuple| ... } ⇒ self
Iterate over each row in the results
59 60 61 62 63 |
# File 'lib/veritas/relation/gateway.rb', line 59 def each return to_enum unless block_given? tuples.each { |tuple| yield tuple } self end |
#intersect(other) ⇒ Gateway, Algebra::Intersection
Return the intersection between relations
152 153 154 |
# File 'lib/veritas/relation/gateway.rb', line 152 def intersect(other) binary_operation(__method__, other, Algebra::Intersection) end |
#join(other) {|relation| ... } ⇒ Gateway, ...
Return a relation that is the join of two relations
94 95 96 97 98 99 100 |
# File 'lib/veritas/relation/gateway.rb', line 94 def join(other) if block_given? super else binary_operation(__method__, other, Algebra::Join) end end |
#product(other) ⇒ Gateway, Algebra::Product
Return a relation that is the cartesian product of two relations
116 117 118 |
# File 'lib/veritas/relation/gateway.rb', line 116 def product(other) binary_operation(__method__, other, Algebra::Product) end |
#respond_to?(method) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test if the method is supported on this object
225 226 227 |
# File 'lib/veritas/relation/gateway.rb', line 225 def respond_to?(method, *) super || forwardable?(method) end |
#summarize(summarize_with = TABLE_DEE) {|function| ... } ⇒ Gateway, Algebra::Summarization
Return a summarized relation
210 211 212 213 214 215 216 |
# File 'lib/veritas/relation/gateway.rb', line 210 def summarize(summarize_with = TABLE_DEE, &block) if summarize_merge?(summarize_with) summarize_merge(summarize_with, &block) else summarize_split(summarize_with, &block) end end |
#union(other) ⇒ Gateway, Algebra::Union
Return the union between relations
134 135 136 |
# File 'lib/veritas/relation/gateway.rb', line 134 def union(other) binary_operation(__method__, other, Algebra::Union) end |