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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Bmg::Relation

#bind, #count, #debug, #delete, empty, #empty?, #insert, new, #one, #one_or_nil, #to_csv, #to_json, #to_xlsx, #update, #visit, #with_type, #with_type_attrlist, #with_typecheck, #without_typecheck, #y_by_x, #ys_by_x

Methods included from Algebra

#allbut, #autosummarize, #autowrap, #constants, #extend, #group, #image, #join, #left_join, #matching, #materialize, #minus, #not_matching, #page, #project, #rename, #restrict, #spied, #summarize, #transform, #ungroup, #union, #unspied, #unwrap

Methods included from Algebra::Shortcuts

#cross_product, #exclude, #image, #images, #join, #left_join, #matching, #not_matching, #prefix, #rxmatch, #suffix, #ungroup, #unwrap, #where

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

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#_countObject



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

def _count
  0
end

#each(&bl) ⇒ Object



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

def each(&bl)
end

#inspectObject



34
35
36
# File 'lib/bmg/relation/empty.rb', line 34

def inspect
  "(empty)"
end

#to_astObject



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

def to_ast
  [ :empty ]
end

#to_sObject



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

def to_s
  "(empty)"
end