Class: Bmg::Relation::Spied
- Inherits:
-
Object
- Object
- Bmg::Relation::Spied
show all
- Includes:
- Operator::Unary
- Defined in:
- lib/bmg/relation/spied.rb
Instance Method Summary
collapse
#bind
Methods included from Operator
#inspect, #to_s
#_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, #minus, #not_matching, #page, #project, #rename, #restrict, #spied, #summarize, #transform, #ungroup, #union, #unwrap
#cross_product, #exclude, #image, #images, #join, #left_join, #matching, #not_matching, #prefix, #rxmatch, #suffix, #ungroup, #unwrap, #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
#count ⇒ Object
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/bmg/relation/spied.rb', line 39
def count
if spy.respond_to?(:measure)
spy.measure(self) do
operand.count
end
else
spy.call(self)
operand.count
end
end
|
#delete(*args, &bl) ⇒ Object
75
76
77
|
# File 'lib/bmg/relation/spied.rb', line 75
def delete(*args, &bl)
operand.delete(*args, &bl)
end
|
#each(&bl) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/bmg/relation/spied.rb', line 26
def each(&bl)
return enum_for(:each) unless bl
if spy.respond_to?(:measure)
spy.measure(self) do
operand.each(&bl)
end
else
spy.call(self)
operand.each(&bl)
end
end
|
#insert(*args, &bl) ⇒ Object
71
72
73
|
# File 'lib/bmg/relation/spied.rb', line 71
def insert(*args, &bl)
operand.insert(*args, &bl)
end
|
#to_ast ⇒ Object
50
51
52
|
# File 'lib/bmg/relation/spied.rb', line 50
def to_ast
[ :spied, operand.to_ast, spy ]
end
|
#type ⇒ Object
17
18
19
|
# File 'lib/bmg/relation/spied.rb', line 17
def type
operand.type
end
|
#unspied ⇒ Object
65
66
67
|
# File 'lib/bmg/relation/spied.rb', line 65
def unspied
operand
end
|
#update(*args, &bl) ⇒ Object
79
80
81
|
# File 'lib/bmg/relation/spied.rb', line 79
def update(*args, &bl)
operand.update(*args, &bl)
end
|