class Interferon::Alert
Public Class Methods
new(path)
click to toggle source
# File lib/interferon/alert.rb, line 3 def initialize(path) @path = path @filename = File.basename(path) @text = File.read(@path) @dsl = nil end
Public Instance Methods
[](attr)
click to toggle source
# File lib/interferon/alert.rb, line 32 def [](attr) raise 'This alert has not yet been evaluated' unless @dsl @dsl.send(attr) end
change_name(name)
click to toggle source
# File lib/interferon/alert.rb, line 26 def change_name(name) raise 'This alert has not yet been evaluated' unless @dsl @dsl.name(name) end
evaluate(hostinfo)
click to toggle source
# File lib/interferon/alert.rb, line 16 def evaluate(hostinfo) return self if @dsl && @dsl.applies == :once dsl = AlertDSL.new(hostinfo) dsl.instance_eval(@text, @filename, 1) @dsl = dsl # return the alert and not the DSL object, which is private self end
to_s()
click to toggle source
# File lib/interferon/alert.rb, line 12 def to_s @filename end