Class: Axiom::Relation::Variable
- Inherits:
-
Axiom::Relation
- Object
- Axiom::Relation
- Axiom::Relation::Variable
- Includes:
- Adamantium::Mutable, Proxy
- Defined in:
- lib/axiom/relation/variable.rb
Overview
A relation variable
Direct Known Subclasses
Defined Under Namespace
Classes: Materialized
Constant Summary
Constants included from Proxy
Proxy::ENUMERABLE_METHODS, Proxy::PROXY_METHODS, Proxy::RELATION_METHODS, Proxy::REMOVE_METHODS
Instance Attribute Summary
Attributes inherited from Axiom::Relation
Class Method Summary collapse
-
.new(relation) ⇒ Relation::Variable
Instantiate a new relation variable.
Instance Method Summary collapse
-
#delete(other) ⇒ self
Delete tuples from the relation variable.
-
#initialize(relation) ⇒ undefined
constructor
private
Initialize a relation variable.
-
#insert(other) ⇒ self
Insert tuples into the relation variable.
-
#replace(other) ⇒ self
Replace the relation variable with new tuples.
Methods included from Proxy
Methods inherited from Axiom::Relation
#==, #[], #directions, #each, #empty?, #include?, #materialize, #materialized?
Methods included from Visitable
Constructor Details
#initialize(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 relation variable
35 36 37 38 |
# File 'lib/axiom/relation/variable.rb', line 35 def initialize(relation) @relation = relation @mutex = Mutex.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Axiom::Relation::Proxy
Class Method Details
.new(relation) ⇒ Relation::Variable
Instantiate a new relation variable
20 21 22 23 24 25 26 |
# File 'lib/axiom/relation/variable.rb', line 20 def self.new(relation) if equal?(Variable) && relation.materialized? Materialized.new(relation) else super end end |
Instance Method Details
#delete(other) ⇒ self
Delete tuples from the relation variable
65 66 67 68 |
# File 'lib/axiom/relation/variable.rb', line 65 def delete(other) @mutex.synchronize { mutate_relation(__method__, other) } self end |
#insert(other) ⇒ self
Insert tuples into the relation variable
50 51 52 53 |
# File 'lib/axiom/relation/variable.rb', line 50 def insert(other) @mutex.synchronize { mutate_relation(__method__, other) } self end |
#replace(other) ⇒ self
Replace the relation variable with new tuples
80 81 82 83 |
# File 'lib/axiom/relation/variable.rb', line 80 def replace(other) @mutex.synchronize { mutate_relation(__method__, other) } self end |