Class: Alf::Relvar::ReadOnly

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

Instance Attribute Summary

Attributes included from Alf::Relvar

#expr

Instance Method Summary collapse

Methods included from Alf::Relvar

#affect, #each, #empty!, #empty?, #not_empty!, #safe, #size, #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

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

Methods included from Lang::ObjectOriented::AggregationMethods

def_aggregator_method

Methods included from Algebra::Operand

#attr_list, coerce, #heading, #keys, #resulting_type, #to_ascii_tree, #to_cog, #type_check

Constructor Details

#initialize(value) ⇒ ReadOnly


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

def initialize(value)
  unless value.is_a?(Algebra::Operand::Proxy)
    value = Algebra::Operand::Proxy.new(value)
  end
  super(value)
end

Instance Method Details

#delete(predicate = Predicate.tautology) ⇒ Object

Raises:


27
28
29
# File 'lib/alf/relvar/read_only.rb', line 27

def delete(predicate = Predicate.tautology)
  raise ReadOnlyError, "Unable to delete in read-only relation variables"
end

#insert(tuples) ⇒ Object

Raises:


23
24
25
# File 'lib/alf/relvar/read_only.rb', line 23

def insert(tuples)
  raise ReadOnlyError, "Unable to insert in read-only relation variables"
end

#lock(mode = :exclusive) ⇒ Object

Update


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

def lock(mode = :exclusive)
  yield
end

#to_relationObject


13
14
15
# File 'lib/alf/relvar/read_only.rb', line 13

def to_relation
  Relation.coerce(expr.subject)
end

#to_sObject

to_xxx


37
38
39
# File 'lib/alf/relvar/read_only.rb', line 37

def to_s
  "Relvar::ReadOnly(#{value.to_s})"
end

#update(updating, predicate) ⇒ Object

Raises:


31
32
33
# File 'lib/alf/relvar/read_only.rb', line 31

def update(updating, predicate)
  raise ReadOnlyError, "Unable to update read-only relation variables"
end