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: []) ⇒ Capture

Returns a new instance of Capture.



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

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

Instance Method Details

#callObject



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

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