Class: Bmg::Relation::Spied

Inherits:
Object
  • Object
show all
Includes:
Operator::Unary
Defined in:
lib/bmg/relation/spied.rb

Instance Method Summary collapse

Methods included from Operator::Unary

#bind

Methods included from Operator

#inspect, #to_s

Methods included from Bmg::Relation

#_count, #bind, #debug, empty, #empty?, new, #one, #one_or_nil, #to_csv, #to_json, #to_xlsx, #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, #not_matching, #page, #project, #rename, #restrict, #spied, #summarize, #transform, #union

Methods included from Algebra::Shortcuts

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

Constructor Details

#initialize(operand, spy) ⇒ Spied

Returns a new instance of Spied.



6
7
8
9
# File 'lib/bmg/relation/spied.rb', line 6

def initialize(operand, spy)
  @operand = operand
  @spy = spy
end

Instance Method Details

#countObject



31
32
33
34
# File 'lib/bmg/relation/spied.rb', line 31

def count
  spy.call(self) if bl
  operand.count
end

#delete(*args, &bl) ⇒ Object



61
62
63
# File 'lib/bmg/relation/spied.rb', line 61

def delete(*args, &bl)
  operand.delete(*args, &bl)
end

#each(&bl) ⇒ Object



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

def each(&bl)
  spy.call(self) if bl
  operand.each(&bl)
end

#insert(*args, &bl) ⇒ Object



57
58
59
# File 'lib/bmg/relation/spied.rb', line 57

def insert(*args, &bl)
  operand.insert(*args, &bl)
end

#to_astObject



36
37
38
# File 'lib/bmg/relation/spied.rb', line 36

def to_ast
  [ :spied, operand.to_ast, spy ]
end

#typeObject



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

def type
  operand.type
end

#unspiedObject



51
52
53
# File 'lib/bmg/relation/spied.rb', line 51

def unspied
  operand
end

#update(*args, &bl) ⇒ Object



65
66
67
# File 'lib/bmg/relation/spied.rb', line 65

def update(*args, &bl)
  operand.update(*args, &bl)
end