Class: Alf::Relvar::Base

Inherits:
Object
  • Object
show all
Includes:
Alf::Relvar
Defined in:
lib/alf-relvar/alf/relvar/base.rb

Instance Attribute Summary collapse

Attributes included from Support::Bindable

#connection

Instance Method Summary collapse

Methods included from Alf::Relvar

#affect, #each, #empty!, #empty?, #not_empty!, #safe, #to_relation, #to_relvar, #type, #upsert, #value

Methods included from Lang::ObjectOriented

new

Methods included from Lang::ObjectOriented::RenderingMethods

def_renderer_method, #to_a, #to_array

Methods included from Lang::ObjectOriented::AlgebraMethods

#!~, #&, #*, #+, #-, #=~, #allbut, def_operator_method, #tuple_extract

Methods included from Lang::ObjectOriented::AggregationMethods

def_aggregator_method

Methods included from Algebra::Operand

#attr_list, coerce, #to_dot, #to_relation

Methods included from Support::Bindable

#bind, #bound?, #connection!

Constructor Details

#initialize(name, connection = nil) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
# File 'lib/alf-relvar/alf/relvar/base.rb', line 6

def initialize(name, connection = nil)
  raise unless name.is_a?(Symbol)
  @name = name
  @connection = connection
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/alf-relvar/alf/relvar/base.rb', line 11

def name
  @name
end

Instance Method Details

#delete(predicate = Predicate.tautology) ⇒ Object



34
35
36
# File 'lib/alf-relvar/alf/relvar/base.rb', line 34

def delete(predicate = Predicate.tautology)
  connection!.delete(name, predicate)
end

#headingObject

Static analysis & inference



15
16
17
# File 'lib/alf-relvar/alf/relvar/base.rb', line 15

def heading
  connection!.heading(name)
end

#insert(tuples) ⇒ Object



29
30
31
32
# File 'lib/alf-relvar/alf/relvar/base.rb', line 29

def insert(tuples)
  tuples = [ tuples ] if TupleLike===tuples
  connection!.insert(name, tuples)
end

#keysObject



19
20
21
# File 'lib/alf-relvar/alf/relvar/base.rb', line 19

def keys
  connection!.keys(name)
end

#lock(mode = :exclusive, &bl) ⇒ Object

Update



25
26
27
# File 'lib/alf-relvar/alf/relvar/base.rb', line 25

def lock(mode = :exclusive, &bl)
  connection!.lock(name, mode, &bl)
end

#to_cogObject

to_xxx



44
45
46
# File 'lib/alf-relvar/alf/relvar/base.rb', line 44

def to_cog
  connection!.cog(name)
end

#to_lispyObject



48
49
50
# File 'lib/alf-relvar/alf/relvar/base.rb', line 48

def to_lispy
  name.to_s
end

#to_sObject



52
53
54
# File 'lib/alf-relvar/alf/relvar/base.rb', line 52

def to_s
  "Relvar::Base(#{name.inspect})"
end

#update(updating, predicate = Predicate.tautology) ⇒ Object



38
39
40
# File 'lib/alf-relvar/alf/relvar/base.rb', line 38

def update(updating, predicate = Predicate.tautology)
  connection!.update(name, updating, predicate)
end