Module: ActiveJson::CLI

Defined in:
lib/cli.rb

Class Method Summary collapse

Class Method Details

.reject(json, where: nil, pluck: nil) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/cli.rb', line 16

def reject(json, where: nil, pluck: nil)
  data = parse_json(json)
  return data unless where || pluck

  filter, pluck = build_query(where, pluck)
  Query.reject(data, where: filter, pluck: pluck)
end

.select(json, where: nil, pluck: nil) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/cli.rb', line 8

def select(json, where: nil, pluck: nil)
  data = parse_json(json)
  return data unless where || pluck

  filter, pluck = build_query(where, pluck)
  Query.select(data, where: filter, pluck: pluck)
end