Class: Core::Inspect::Inspection

Inherits:
Object
  • Object
show all
Defined in:
lib/core/inspect/inspection.rb

Overview

public

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, resolver: name.to_s) ⇒ Inspection

Returns a new instance of Inspection.



8
9
10
11
# File 'lib/core/inspect/inspection.rb', line 8

def initialize(name:, resolver: name.to_s)
  @name = name.to_s
  @resolver = resolver
end

Instance Attribute Details

#nameObject (readonly)

public


15
16
17
# File 'lib/core/inspect/inspection.rb', line 15

def name
  @name
end

Instance Method Details

#resolve(context) ⇒ Object

public


19
20
21
22
23
24
25
# File 'lib/core/inspect/inspection.rb', line 19

def resolve(context)
  if @resolver.start_with?("@")
    context.instance_variable_get(@resolver)
  else
    context.__send__(@resolver)
  end
end