Class: MonkeyLens::Capture

Inherits:
Object
  • Object
show all
Defined in:
lib/monkey_lens/capture.rb

Constant Summary collapse

VISIBILITIES =
%i[public protected private].freeze

Instance Method Summary collapse

Constructor Details

#initialize(targets:, ignore_methods: [], provenance: false) ⇒ Capture

Returns a new instance of Capture.



9
10
11
12
13
# File 'lib/monkey_lens/capture.rb', line 9

def initialize(targets:, ignore_methods: [], provenance: false)
  @targets = targets
  @ignore_methods = ignore_methods.to_set
  @provenance = provenance
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/monkey_lens/capture.rb', line 15

def call
  records = @targets.sort.to_h do |target_name|
    target = constantize(target_name)
    [target_name, capture_target(target_name, target)]
  end

  Snapshot.new(
    schema: Snapshot::SCHEMA,
    ruby: RUBY_DESCRIPTION,
    engine: defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby",
    targets: records
  )
end