Class: LogSnag::EventBase Abstract
- Inherits:
-
Object
- Object
- LogSnag::EventBase
- Defined in:
- lib/logsnag/event_base.rb
Overview
Instance Attribute Summary collapse
-
#config ⇒ LogSnag::Configuration
readonly
The configuration object.
-
#data ⇒ Hash
readonly
The data to be sent to LogSnag.
Instance Method Summary collapse
-
#initialize(data, config) ⇒ EventBase
constructor
A new instance of EventBase.
- #to_json(*_args) ⇒ Object
Constructor Details
#initialize(data, config) ⇒ EventBase
Returns a new instance of EventBase.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/logsnag/event_base.rb', line 14 def initialize(data, config) @data = data @config = config raise ArgumentError, "`data` must be a Hash" unless data.is_a?(Hash) return if config.is_a?(LogSnag::Configuration) raise ArgumentError, "LogSnag::Configuration not found. Did you call LogSnag.configure?" end |
Instance Attribute Details
#config ⇒ LogSnag::Configuration (readonly)
The configuration object.
11 12 13 |
# File 'lib/logsnag/event_base.rb', line 11 def config @config end |
#data ⇒ Hash (readonly)
The data to be sent to LogSnag.
11 12 13 |
# File 'lib/logsnag/event_base.rb', line 11 def data @data end |
Instance Method Details
#to_json(*_args) ⇒ Object
26 27 28 |
# File 'lib/logsnag/event_base.rb', line 26 def to_json(*_args) data.to_json end |