Class: Axiom::Relation::Operation::Offset
- Inherits:
-
Axiom::Relation
- Object
- Axiom::Relation
- Axiom::Relation::Operation::Offset
- Includes:
- Unary
- Defined in:
- lib/axiom/relation/operation/offset.rb
Overview
A class representing an offset relation
Defined Under Namespace
Modules: Methods
Instance Attribute Summary collapse
-
#directions ⇒ Operation::Sorted::DirectionSet
readonly
private
The relation sort order.
-
#offset ⇒ Integer
readonly
Return the offset.
Attributes included from Operation::Unary
Attributes inherited from Axiom::Relation
Class Method Summary collapse
-
.new(operand, offset) ⇒ Offset
Instantiate a new Offset.
Instance Method Summary collapse
-
#delete ⇒ undefined
Raise an exception when deleting from the Offset.
-
#each {|tuple| ... } ⇒ self
Iterate over each tuple in the set.
-
#initialize(operand, offset) ⇒ undefined
constructor
private
Initialize an Offset.
-
#insert ⇒ undefined
Raise an exception when inserting into the Offset.
Methods inherited from Axiom::Relation
#==, #[], #empty?, #include?, #materialize, #materialized?, #replace
Methods included from Visitable
Constructor Details
#initialize(operand, offset) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize an Offset
92 93 94 95 96 |
# File 'lib/axiom/relation/operation/offset.rb', line 92 def initialize(operand, offset) super(operand) @offset = offset @directions = operand.directions end |
Instance Attribute Details
#directions ⇒ Operation::Sorted::DirectionSet (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The relation sort order
27 28 29 |
# File 'lib/axiom/relation/operation/offset.rb', line 27 def directions @directions end |
#offset ⇒ Integer (readonly)
Return the offset
20 21 22 |
# File 'lib/axiom/relation/operation/offset.rb', line 20 def offset @offset end |
Class Method Details
.new(operand, offset) ⇒ Offset
Instantiate a new Offset
42 43 44 45 46 |
# File 'lib/axiom/relation/operation/offset.rb', line 42 def self.new(operand, offset) assert_sorted_operand(operand) assert_valid_offset(offset) super end |
Instance Method Details
#delete ⇒ undefined
Raise an exception when deleting from the Offset
146 147 148 |
# File 'lib/axiom/relation/operation/offset.rb', line 146 def delete(*) fail ImmutableRelationError, 'deleting from an offset is impossible' end |
#each {|tuple| ... } ⇒ self
Iterate over each tuple in the set
112 113 114 115 116 117 118 |
# File 'lib/axiom/relation/operation/offset.rb', line 112 def each return to_enum unless block_given? operand.each_with_index do |tuple, index| yield tuple if index >= @offset end self end |
#insert ⇒ undefined
Raise an exception when inserting into the Offset
131 132 133 |
# File 'lib/axiom/relation/operation/offset.rb', line 131 def insert(*) fail ImmutableRelationError, 'inserting into an offset is impossible' end |