Module: Aquarium::Aspects::AdviceChainNodeFactory
- Defined in:
- lib/aquarium/aspects/advice.rb
Overview
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.
Class Method Summary collapse
Class Method Details
.make_node(options = {}) ⇒ Object
278 279 280 281 282 283 284 285 |
# File 'lib/aquarium/aspects/advice.rb', line 278 def self.make_node = {} advice_kind = [:advice_kind] raise Aquarium::Utils::InvalidOptions.new("Unknown advice kind specified: #{advice_kind}") unless valid(advice_kind) advice_kind = :no if advice_kind == :none advice_chain_node_name = Aquarium::Utils::CamelCase.to_camel_case(advice_kind.to_s) + "AdviceChainNode" clazz = Aquarium::Aspects.const_get advice_chain_node_name clazz.new end |
.valid(advice_kind) ⇒ Object
287 288 289 |
# File 'lib/aquarium/aspects/advice.rb', line 287 def self.valid advice_kind advice_kind == :no || advice_kind == :none || Advice.kinds.include?(advice_kind) end |