Module: CallLogger

Defined in:
lib/call_logger.rb,
lib/call_logger/logger.rb,
lib/call_logger/version.rb,
lib/call_logger/formatter.rb,
lib/call_logger/call_wrapper.rb,
lib/call_logger/configuration.rb,
lib/call_logger/method_wrapper.rb

Defined Under Namespace

Modules: ClassMethods Classes: CallWrapper, Configuration, Formatter, Logger, MethodWrapper

Constant Summary collapse

VERSION =
"0.6.0"

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



15
16
17
# File 'lib/call_logger.rb', line 15

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



18
19
20
21
# File 'lib/call_logger.rb', line 18

def self.configure
  self.configuration ||= Configuration.new
  yield(configuration) if block_given?
end

.included(base) ⇒ Object



10
11
12
# File 'lib/call_logger.rb', line 10

def self.included(base)
  base.extend(ClassMethods)
end

.log_block(name, &block) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/call_logger.rb', line 28

def self.log_block(name, &block)
  logger = configuration.logger
  formatter = configuration.formatter
  call_wrapper = CallWrapper.new(
    logger: logger, formatter: formatter
  )
  call_wrapper.call(name, [], &block)
end

Instance Method Details

#log_block(name, &block) ⇒ Object



24
25
26
# File 'lib/call_logger.rb', line 24

def log_block(name, &block)
  self.class.log_block(name, &block)
end