Class: Alf::Relvar::ReadOnly
- Inherits:
-
Object
- Object
- Alf::Relvar::ReadOnly
- Includes:
- Alf::Relvar
- Defined in:
- lib/alf/relvar/read_only.rb
Instance Attribute Summary
Attributes included from Alf::Relvar
Instance Method Summary collapse
- #delete(predicate = Predicate.tautology) ⇒ Object
-
#initialize(value) ⇒ ReadOnly
constructor
A new instance of ReadOnly.
- #insert(tuples) ⇒ Object
-
#lock(mode = :exclusive) ⇒ Object
Update.
- #to_relation ⇒ Object
-
#to_s ⇒ Object
to_xxx.
- #update(updating, predicate) ⇒ Object
Methods included from Alf::Relvar
#affect, #each, #empty!, #empty?, #not_empty!, #safe, #to_relvar, #type, #upsert, #value
Methods included from Lang::ObjectOriented
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
Methods included from Algebra::Operand
#attr_list, coerce, #heading, #keys, #resulting_type, #to_ascii_tree, #to_cog, #type_check
Constructor Details
#initialize(value) ⇒ ReadOnly
Returns a new instance of 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
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
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_relation ⇒ Object
13 14 15 |
# File 'lib/alf/relvar/read_only.rb', line 13 def to_relation Relation.coerce(expr.subject) end |
#to_s ⇒ Object
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
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 |