Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 50 lines (42 sloc) 1.131 kb
4b08517 Added #is and #is_not to use the ObjectFilterPipe
Darrick Wiebe authored
1 module Pacer
2 module Routes
3 module RouteOperations
4 def is(value)
761a6bf Remove workaround for fixed bug and pending from Dex test that now pa…
Darrick Wiebe authored
5 if value.is_a? Symbol
6 chain_route :filter => :property, :block => proc { |v| v.vars[value] == v }
f530717 Breaking change to #only and #except:
Darrick Wiebe authored
7 else
761a6bf Remove workaround for fixed bug and pending from Dex test that now pa…
Darrick Wiebe authored
8 chain_route({ :filter => :object, :value => value })
f530717 Breaking change to #only and #except:
Darrick Wiebe authored
9 end
4b08517 Added #is and #is_not to use the ObjectFilterPipe
Darrick Wiebe authored
10 end
11
12 def is_not(value)
761a6bf Remove workaround for fixed bug and pending from Dex test that now pa…
Darrick Wiebe authored
13 if value.is_a? Symbol
14 chain_route :filter => :property, :block => proc { |v| v.vars[value] != v }
f530717 Breaking change to #only and #except:
Darrick Wiebe authored
15 else
761a6bf Remove workaround for fixed bug and pending from Dex test that now pa…
Darrick Wiebe authored
16 chain_route({ :filter => :object, :value => value, :negate => true })
f530717 Breaking change to #only and #except:
Darrick Wiebe authored
17 end
4b08517 Added #is and #is_not to use the ObjectFilterPipe
Darrick Wiebe authored
18 end
6f2ee4f Add #compact step
Darrick Wiebe authored
19
20 def compact
21 is_not nil
22 end
4b08517 Added #is and #is_not to use the ObjectFilterPipe
Darrick Wiebe authored
23 end
24 end
25
26 module Filter
27 module ObjectFilter
28 import com.tinkerpop.pipes.filter.ObjectFilterPipe
29
30 attr_accessor :value, :negate
31
32 protected
33
34 def attach_pipe(end_pipe)
35 pipe = ObjectFilterPipe.new(value, negate ? Pacer::Pipes::NOT_EQUAL : Pacer::Pipes::EQUAL)
36 pipe.set_starts end_pipe if end_pipe
37 pipe
38 end
5e0799e Minor improvements to console output.
Darrick Wiebe authored
39
40 def inspect_string
41 if negate
42 "is_not(#{ value.inspect })"
43 else
44 "is(#{ value.inspect })"
45 end
46 end
4b08517 Added #is and #is_not to use the ObjectFilterPipe
Darrick Wiebe authored
47 end
48 end
49 end
Something went wrong with that request. Please try again.