Sha256: fb3046b3e77e15c14d01055818f380c8f2c97c171f3a534c29ad5d5331bcb3fe

Contents?: true

Size: 499 Bytes

Versions: 3

Compression:

Stored size: 499 Bytes

Contents

# frozen_string_literal: true

module Core
  module Inspect
    # [public]
    #
    class Inspection
      def initialize(name:, resolver: name.to_s)
        @name = name.to_s
        @resolver = resolver
      end

      # [public]
      #
      attr_reader :name

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
core-inspect-0.2.0 lib/core/inspect/inspection.rb
core-inspect-0.1.1 lib/core/inspect/inspection.rb
core-inspect-0.1.0 lib/core/inspect/inspection.rb