Module: TrajectPlus::Macros::JSON
- Defined in:
- lib/traject_plus/macros/json.rb
Overview
Macros for extracting values from JSON documents
Instance Method Summary collapse
Instance Method Details
#extract_json(path, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/traject_plus/macros/json.rb', line 11 def extract_json(path, = {}) lambda do |json, accumulator, _context| result = Array(JsonPath.on(json, path)) result = TrajectPlus::Extraction.(result, ) unless .empty? Deprecation.warn(self, "passing options to extract_json is deprecated and will be removed in the next major release. Use the Traject 3 pipeline instead") end accumulator.concat(result) end end |