sensu-plugins / sensu-plugin

A framework for writing Sensu plugins & handlers with Ruby.
http://sensuapp.org
MIT License
126 stars 117 forks source link

Creating Base mutator class #105

Closed zbintliff closed 8 years ago

zbintliff commented 8 years ago

Making a base Sensu::Mutator class. Personally, I'm not a fan of autorun. Makes complete testing a pain.

With the given base mutator all they need is something like this:

class SampleMutator < Sensu::Mutator
  def mutate
    @event.merge!(:mutated => true)
  end
end

mutator = SampleMutator.new
puts mutator.execute

If you think that we should follow standard and use auto run, I'll change it to work with that. Also, if you want the base mutator to output the JSON by default we can do that too. I like it being explicit for testing purposes.