Class: Bmg::Relation::Empty

Inherits:
Object
  • Object
show all
Includes:
Bmg::Relation
Defined in:
lib/bmg/relation/empty.rb

Overview

The empty relation, of a given type.

This relation implementation exists mostly for optimization purposes, since knowing that a relation is empty allows simplifying many expressions.

Constant Summary

Constants included from Algebra

Algebra::METHODS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Bmg::Relation

#debug, #delete, empty, #empty?, #insert, new, #one, #one_or_nil, #to_json, #update, #visit, #ys_by_x

Methods included from Algebra

#allbut, #autosummarize, #autowrap, #constants, #extend, #image, #matching, #project, #rename, #restrict, #spied, #union, #unspied

Constructor Details

#initialize(type) ⇒ Empty

Returns a new instance of Empty.



13
14
15
# File 'lib/bmg/relation/empty.rb', line 13

def initialize(type)
  @type = type
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



16
17
18
# File 'lib/bmg/relation/empty.rb', line 16

def type
  @type
end

Instance Method Details

#each(&bl) ⇒ Object



18
19
# File 'lib/bmg/relation/empty.rb', line 18

def each(&bl)
end

#inspectObject



29
30
31
# File 'lib/bmg/relation/empty.rb', line 29

def inspect
  "(empty)"
end

#to_astObject



21
22
23
# File 'lib/bmg/relation/empty.rb', line 21

def to_ast
  [ :empty ]
end

#to_sObject



25
26
27
# File 'lib/bmg/relation/empty.rb', line 25

def to_s
  "(empty)"
end