Module: Alf::Algebra::Operand

Includes:
Support::Bindable
Included in:
Fake, Named, Proxy, Operator, Relation, Relvar
Defined in:
lib/alf-algebra/alf/algebra/operand.rb,
lib/alf-algebra/alf/algebra/operand/fake.rb,
lib/alf-algebra/alf/algebra/operand/named.rb,
lib/alf-algebra/alf/algebra/operand/proxy.rb

Defined Under Namespace

Classes: Fake, Named, Proxy

Instance Attribute Summary

Attributes included from Support::Bindable

#connection

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Support::Bindable

#bind, #bound?, #connection!

Class Method Details

.coerce(op) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/alf-algebra/alf/algebra/operand.rb', line 6

def self.coerce(op)
  case op
  when Operand     then op
  when Symbol      then Operand::Named.new(op)
  when Reader      then Proxy.new(op)
  when Array       then Proxy.new(op)
  when Engine::Cog then Proxy.new(op)
  when TupleLike   then Proxy.new([op])
  else
    who = op.inspect
    who = "#{who[0..20]}..." if who.size>20
    raise TypeError, "Invalid relational operand `#{who}`"
  end
end

Instance Method Details

#attr_listObject



27
28
29
# File 'lib/alf-algebra/alf/algebra/operand.rb', line 27

def attr_list
  heading.to_attr_list
end

#headingObject

Static analysis & inference

Raises:



23
24
25
# File 'lib/alf-algebra/alf/algebra/operand.rb', line 23

def heading
  raise NotSupportedError
end

#keysObject

Raises:



31
32
33
# File 'lib/alf-algebra/alf/algebra/operand.rb', line 31

def keys
  raise NotSupportedError
end

#to_cogObject

to_xxx



37
38
39
# File 'lib/alf-algebra/alf/algebra/operand.rb', line 37

def to_cog
  to_relvar.to_cog
end

#to_dot(buffer = "") ⇒ Object



45
46
47
# File 'lib/alf-algebra/alf/algebra/operand.rb', line 45

def to_dot(buffer = "")
  Algebra::ToDot.new.call(self, buffer)
end

#to_relationObject



41
42
43
# File 'lib/alf-algebra/alf/algebra/operand.rb', line 41

def to_relation
  to_relvar.to_relation
end