Class: Kim::EmailDevice
- Inherits:
-
Object
- Object
- Kim::EmailDevice
- Defined in:
- lib/kim-logger/email_device.rb
Constant Summary collapse
- @@settings =
DEFAULTS
{ :from => 'logger@localhost', :subject => 'Email Log', :host => 'localhost', :port => 25 }
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#settings ⇒ Object
Returns the value of attribute settings.
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
- #effective_settings ⇒ Object
-
#initialize(email, settings = {}) ⇒ EmailDevice
constructor
A new instance of EmailDevice.
- #write(message) ⇒ Object
Constructor Details
#initialize(email, settings = {}) ⇒ EmailDevice
Returns a new instance of EmailDevice.
13 14 15 16 |
# File 'lib/kim-logger/email_device.rb', line 13 def initialize email, settings = {} self.email = email self.settings = settings end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/kim-logger/email_device.rb', line 3 def email @email end |
#settings ⇒ Object
Returns the value of attribute settings.
3 4 5 |
# File 'lib/kim-logger/email_device.rb', line 3 def settings @settings end |
Class Method Details
.settings ⇒ Object
26 27 28 |
# File 'lib/kim-logger/email_device.rb', line 26 def self.settings @@settings end |
.settings=(value) ⇒ Object
30 31 32 |
# File 'lib/kim-logger/email_device.rb', line 30 def self.settings= value @@settings = value end |
Instance Method Details
#close ⇒ Object
22 23 24 |
# File 'lib/kim-logger/email_device.rb', line 22 def close # Do nothing end |
#effective_settings ⇒ Object
34 35 36 |
# File 'lib/kim-logger/email_device.rb', line 34 def effective_settings @@settings.deep_merge self.settings end |
#write(message) ⇒ Object
18 19 20 |
# File 'lib/kim-logger/email_device.rb', line 18 def write send_email effective_settings[:from], self.email, end |