Class: MetricCollect::Backend::Email
- Inherits:
-
Object
- Object
- MetricCollect::Backend::Email
- Defined in:
- lib/backend/email.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(name) ⇒ Email
constructor
A new instance of Email.
- #method_missing(method_symbol, *args, &block) ⇒ Object
- #process_metric(config) ⇒ Object
Constructor Details
#initialize(name) ⇒ Email
Returns a new instance of Email.
23 24 25 26 27 28 29 30 |
# File 'lib/backend/email.rb', line 23 def initialize(name) @params = Hash.new @params[:name] = name @params[:value] = nil @params[:subject] = 'Message from Metrics Collect' @params[:body] = nil @params[:to] = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_symbol, *args, &block) ⇒ Object
32 33 34 |
# File 'lib/backend/email.rb', line 32 def method_missing(method_symbol, *args, &block) @params[method_symbol] end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
36 37 38 |
# File 'lib/backend/email.rb', line 36 def params @params end |
Instance Method Details
#process_metric(config) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/backend/email.rb', line 38 def process_metric(config) name = @params[:name] value = @params[:value] subject = @params[:subject] body = @params[:body] to = @params[:to] @config = config.params send_email(name, value, to, subject, body) end |