Class: StimulusReflex::Logger
- Inherits:
-
Object
- Object
- StimulusReflex::Logger
- Defined in:
- lib/stimulus_reflex/utils/logger.rb
Instance Attribute Summary collapse
-
#current_operation ⇒ Object
Returns the value of attribute current_operation.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#reflex ⇒ Object
Returns the value of attribute reflex.
Instance Method Summary collapse
-
#initialize(reflex) ⇒ Logger
constructor
A new instance of Logger.
- #log_all_operations ⇒ Object
Constructor Details
#initialize(reflex) ⇒ Logger
Returns a new instance of Logger.
10 11 12 13 14 |
# File 'lib/stimulus_reflex/utils/logger.rb', line 10 def initialize(reflex) @reflex = reflex @current_operation = 1 @logger = StimulusReflex.config.logger end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object (private)
96 97 98 99 100 101 102 103 104 |
# File 'lib/stimulus_reflex/utils/logger.rb', line 96 def method_missing(name, *args) return send(name) if private_instance_methods.include?(name.to_sym) reflex.connection.identifiers.each do |identifier| ident = reflex.connection.send(identifier) return ident.send(name) if ident.respond_to?(:attributes) && ident.attributes.key?(name.to_s) end "-" end |
Instance Attribute Details
#current_operation ⇒ Object
Returns the value of attribute current_operation.
6 7 8 |
# File 'lib/stimulus_reflex/utils/logger.rb', line 6 def current_operation @current_operation end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
5 6 7 |
# File 'lib/stimulus_reflex/utils/logger.rb', line 5 def logger @logger end |
#reflex ⇒ Object
Returns the value of attribute reflex.
6 7 8 |
# File 'lib/stimulus_reflex/utils/logger.rb', line 6 def reflex @reflex end |
Instance Method Details
#log_all_operations ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/stimulus_reflex/utils/logger.rb', line 16 def log_all_operations return unless config_logging.instance_of?(Proc) reflex.broadcaster.operations.each do logger.info instance_eval(&config_logging) + "\e[0m" @current_operation += 1 end end |