Class: Leakferret::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/leakferret/client.rb

Overview

Thin shell-out wrapper. Each public method invokes the binary with ‘–format json` and parses the resulting array.

Instance Method Summary collapse

Instance Method Details

#rewrite(path, apply: false, backend: 'env', **opts) ⇒ Object



19
20
21
22
23
# File 'lib/leakferret/client.rb', line 19

def rewrite(path, apply: false, backend: 'env', **opts)
  args = ['rewrite', path, '--format', 'json', '--backend', backend]
  args << '--apply' if apply
  run(args + format_flags(**opts))
end

#scan(path, exclude: [], only: nil, show_fixtures: false) ⇒ Object



10
11
12
# File 'lib/leakferret/client.rb', line 10

def scan(path, exclude: [], only: nil, show_fixtures: false)
  run(['scan', path, '--format', 'json'] + format_flags(exclude:, only:, show_fixtures:))
end

#verify(path, mode: 'best-effort', timeout: 10, **opts) ⇒ Object



14
15
16
17
# File 'lib/leakferret/client.rb', line 14

def verify(path, mode: 'best-effort', timeout: 10, **opts)
  run(['verify', path, '--format', 'json', '--verify-mode', mode,
       '--verifier-timeout-secs', timeout.to_s] + format_flags(**opts))
end