Module: Brine::Selecting
- Included in:
- Brine
- Defined in:
- lib/brine/selecting.rb
Overview
A module providing assorted means to select particular values out of objects/graphs.
Defined Under Namespace
Classes: AllSelector, AnySelector, Selector
Instance Method Summary collapse
-
#select(target, negated = nil) ⇒ Object
Activate a Selector for the provided target.
-
#select_all(target, negated = nil) ⇒ Object
Activate a Selector for all of the children of the provided target.
-
#select_any(target, negated = nil) ⇒ Object
Activate a Selector for any of the children of the provided target.
-
#selector ⇒ Object
The currently active Selector.
-
#use_selector(selector) ⇒ Object
Configure selector and make it the active Selector.
Instance Method Details
#select(target, negated = nil) ⇒ Object
Activate a Selector for the provided target.
104 105 106 |
# File 'lib/brine/selecting.rb', line 104 def select(target, negated=nil) use_selector(Selector.new(target, negated)) end |
#select_all(target, negated = nil) ⇒ Object
Activate a Selector for all of the children of the provided target.
124 125 126 |
# File 'lib/brine/selecting.rb', line 124 def select_all(target, negated=nil) use_selector(AllSelector.new(target, negated)) end |
#select_any(target, negated = nil) ⇒ Object
Activate a Selector for any of the children of the provided target.
114 115 116 |
# File 'lib/brine/selecting.rb', line 114 def select_any(target, negated=nil) use_selector(AnySelector.new(target, negated)) end |
#selector ⇒ Object
The currently active Selector.
143 144 145 |
# File 'lib/brine/selecting.rb', line 143 def selector @selector end |
#use_selector(selector) ⇒ Object
Configure selector and make it the active Selector.
133 134 135 136 |
# File 'lib/brine/selecting.rb', line 133 def use_selector(selector) selector.coercer = coercer @selector = selector end |