Module: Bulldogger::ExecutionTarget

Defined in:
lib/bulldogger/execution_target.rb

Overview

Parses and validates targets for verbs that re-execute application frames. Collector launch and evidence writing stay in each verb.

Defined Under Namespace

Classes: Target

Constant Summary collapse

FID_PATTERN =
/\A(.+):([^:#]+)#([1-9]\d*)\z/

Class Method Summary collapse

Class Method Details

.acceptable?(target, index:, code_state:, verb:, stderr:, fid:) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
32
33
34
# File 'lib/bulldogger/execution_target.rb', line 29

def acceptable?(target, index:, code_state:, verb:, stderr:, fid:)
  return false unless target.application_path?(verb, stderr)
  return false unless index_state_matches?(index, code_state, verb, stderr)

  addressable?(fid, index, verb, stderr)
end

.parse(fid, verb) ⇒ Object

Raises:

  • (ArgumentError)


21
22
23
24
25
26
27
# File 'lib/bulldogger/execution_target.rb', line 21

def parse(fid, verb)
  match = FID_PATTERN.match(fid)
  raise ArgumentError, "#{verb} requires a fid in 'path:method#k' form" unless match

  root = File.expand_path(Dir.pwd)
  Target.new(path: File.expand_path(match[1], root), method: match[2], index: Integer(match[3], 10), root: root)
end