Class: SearchKit::Messaging::Message
- Inherits:
-
Object
- Object
- SearchKit::Messaging::Message
- Defined in:
- lib/search_kit/messaging.rb
Overview
Most of the logic for the Messaging module exists in this (not so) private class. This lets more complex handling of message logic enter into the module gracefully, for example silence or logging level.
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#feedback ⇒ Object
readonly
Returns the value of attribute feedback.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #info ⇒ Object
-
#initialize(message) ⇒ Message
constructor
A new instance of Message.
- #warn ⇒ Object
Constructor Details
#initialize(message) ⇒ Message
26 27 28 29 30 |
# File 'lib/search_kit/messaging.rb', line 26 def initialize() @env = SearchKit.config.app_env.to_s.ansi(:magenta) @feedback = SearchKit.config.verbose = end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
24 25 26 |
# File 'lib/search_kit/messaging.rb', line 24 def env @env end |
#feedback ⇒ Object (readonly)
Returns the value of attribute feedback.
24 25 26 |
# File 'lib/search_kit/messaging.rb', line 24 def feedback @feedback end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
24 25 26 |
# File 'lib/search_kit/messaging.rb', line 24 def end |
Instance Method Details
#info ⇒ Object
37 38 39 40 |
# File 'lib/search_kit/messaging.rb', line 37 def info Kernel.puts("--> [ #{env} ]: #{message.ansi(:cyan)}") if feedback SearchKit.logger.info end |
#warn ⇒ Object
32 33 34 35 |
# File 'lib/search_kit/messaging.rb', line 32 def warn Kernel.warn("--> [ #{env} ]: #{message.ansi(:red)}") if feedback SearchKit.logger.warn end |