Class: Trifle::Logs::Operations::Dump
- Inherits:
-
Object
- Object
- Trifle::Logs::Operations::Dump
- Defined in:
- lib/trifle/logs/operations/dump.rb
Instance Attribute Summary collapse
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
- #config ⇒ Object
- #formatted ⇒ Object
-
#initialize(**keywords) ⇒ Dump
constructor
A new instance of Dump.
- #perform ⇒ Object
Constructor Details
#initialize(**keywords) ⇒ Dump
Returns a new instance of Dump.
9 10 11 12 13 14 |
# File 'lib/trifle/logs/operations/dump.rb', line 9 def initialize(**keywords) @namespace = keywords.fetch(:namespace) @payload = keywords.fetch(:payload) @scope = keywords.fetch(:scope) @config = keywords[:config] end |
Instance Attribute Details
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
7 8 9 |
# File 'lib/trifle/logs/operations/dump.rb', line 7 def namespace @namespace end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
7 8 9 |
# File 'lib/trifle/logs/operations/dump.rb', line 7 def payload @payload end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
7 8 9 |
# File 'lib/trifle/logs/operations/dump.rb', line 7 def scope @scope end |
Instance Method Details
#config ⇒ Object
16 17 18 |
# File 'lib/trifle/logs/operations/dump.rb', line 16 def config @config || Trifle::Logs.default end |
#formatted ⇒ Object
20 21 22 23 24 25 |
# File 'lib/trifle/logs/operations/dump.rb', line 20 def formatted [ config..format(Time.now), config.content_formatter.format(scope, payload) ].join(' ') end |
#perform ⇒ Object
27 28 29 30 31 |
# File 'lib/trifle/logs/operations/dump.rb', line 27 def perform config.driver.dump( formatted, namespace: namespace ) end |