Sha256: b29d54d3f4d187a45d80fc49fba189e05b759c28044fd0248efd51472fa2e8d4

Contents?: true

Size: 543 Bytes

Versions: 1

Compression:

Stored size: 543 Bytes

Contents

module Aspector
  class Context

    attr_accessor :method_name

    def initialize(target, aspect_hash, advice_hash)
      @target = target
      @aspect_hash = aspect_hash
      @advice_hash = advice_hash
    end

    def aspect
      @aspect ||= @target.instance_variable_get(:@aspector_instances).detect do |aspect|
        aspect.hash == @aspect_hash
      end
    end

    def advice
      @advice ||= aspect.class.advices.detect { |advice| advice.hash == @advice_hash }
    end

    def options
      aspect.options
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aspector-0.7.0 lib/aspector/context.rb