Class: Alf::Relvar::ReadOnly

Inherits:
Object
  • Object
show all
Includes:
Alf::Relvar
Defined in:
lib/alf-relvar/alf/relvar/read_only.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_relvar, #upsert

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

Methods included from Support::Bindable

#bind, #bound?, #connection!

Constructor Details

#initialize(value) ⇒ ReadOnly

Returns a new instance of ReadOnly.



6
7
8
# File 'lib/alf-relvar/alf/relvar/read_only.rb', line 6

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly) Also known as: to_relation

Returns the value of attribute value.



9
10
11
# File 'lib/alf-relvar/alf/relvar/read_only.rb', line 9

def value
  @value
end

Instance Method Details

#delete(predicate = Predicate.tautology) ⇒ Object

Raises:



35
36
37
# File 'lib/alf-relvar/alf/relvar/read_only.rb', line 35

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

#headingObject



17
18
19
# File 'lib/alf-relvar/alf/relvar/read_only.rb', line 17

def heading
  value.heading
end

#insert(tuples) ⇒ Object

Raises:



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

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

#keysObject



21
22
23
# File 'lib/alf-relvar/alf/relvar/read_only.rb', line 21

def keys
  value.keys
end

#lock(mode = :exclusive) ⇒ Object

Update



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

def lock(mode = :exclusive)
  yield
end

#to_cogObject



47
48
49
# File 'lib/alf-relvar/alf/relvar/read_only.rb', line 47

def to_cog
  value.to_cog
end

#to_lispyObject



51
52
53
# File 'lib/alf-relvar/alf/relvar/read_only.rb', line 51

def to_lispy
  value.to_lispy
end

#to_sObject



55
56
57
# File 'lib/alf-relvar/alf/relvar/read_only.rb', line 55

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

#typeObject

Static analysis & inference



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

def type
  value.class
end

#update(updating, predicate) ⇒ Object

Raises:



39
40
41
# File 'lib/alf-relvar/alf/relvar/read_only.rb', line 39

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