class Apullo::Fingerprint::Base

Attributes

target[R]

Public Class Methods

new(target) click to toggle source
# File lib/apullo/fingerprints/base.rb, line 8
def initialize(target)
  @target = target
  @results = nil
end

Private Class Methods

inherited(child) click to toggle source
# File lib/apullo/fingerprints/base.rb, line 39
def inherited(child)
  Apullo.fingerprints << child
end

Public Instance Methods

name() click to toggle source
# File lib/apullo/fingerprints/base.rb, line 13
def name
  self.class.to_s.split("::").last.to_s.downcase
end
results() click to toggle source
# File lib/apullo/fingerprints/base.rb, line 17
def results
  return @results if @results

  with_error_handling do
    @results ||= build_results
  end
  @results
end

Private Instance Methods

build_results() click to toggle source
# File lib/apullo/fingerprints/base.rb, line 34
def build_results
  raise NotImplementedError, "You must implement #{self.class}##{__method__}"
end
with_error_handling() { || ... } click to toggle source
# File lib/apullo/fingerprints/base.rb, line 28
def with_error_handling
  yield
rescue StandardError => e
  @results = { error: e.to_s }
end