module Aquarium::Aspects::AdviceChainNodeFactory

The advice_kind argument must be one of the values returned by Advice.kinds or one of the special values “:no” or “:none”, signfying a node for which there is no advice, where the actual method being advised is called directly instead. This kind of node is normally used as the terminal leaf in the chain.

Public Class Methods

make_node(options = {}) click to toggle source
    # File lib/aquarium/aspects/advice.rb
278 def self.make_node options = {}
279   advice_kind = options[:advice_kind]
280   raise Aquarium::Utils::InvalidOptions.new("Unknown advice kind specified: #{advice_kind}") unless valid(advice_kind)
281   advice_kind = :no if advice_kind == :none
282   advice_chain_node_name = Aquarium::Utils::CamelCase.to_camel_case(advice_kind.to_s) + "AdviceChainNode"
283   clazz = Aquarium::Aspects.const_get advice_chain_node_name
284   clazz.new options
285 end
valid(advice_kind) click to toggle source
    # File lib/aquarium/aspects/advice.rb
287 def self.valid advice_kind
288   advice_kind == :no || advice_kind == :none || Advice.kinds.include?(advice_kind)
289 end