class Spectroscope::Hooks::Hook
Encapsulates a hook procedure along with it's match tags.
Public Class Methods
new(tense, scope, *tags, &proc)
click to toggle source
A brief description of the advice (optional).
attr :subject
# File lib/spectroscope/hooks.rb, line 77 def initialize(tense, scope, *tags, &proc) @tense = tense @scope = scope @tags = tags @proc = proc end
Public Instance Methods
match?(it)
click to toggle source
Check for matching subjects or tags for each advice.
# File lib/spectroscope/hooks.rb, line 87 def match?(it) return true if @tags.empty? @tags.any? do |t| it.match?(t) end end
to_proc()
click to toggle source
# File lib/spectroscope/hooks.rb, line 96 def to_proc @proc end