Module: LogMarker

Defined in:
lib/log_marker.rb,
lib/log_marker/config.rb,
lib/log_marker/version.rb

Constant Summary collapse

MARK_METHODS =
%w(p pp puts)
VERSION =
'0.1.3'

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.markerObject

Returns the value of attribute marker.



5
6
7
# File 'lib/log_marker/config.rb', line 5

def marker
  @marker
end

.ml_aliasObject

Returns the value of attribute ml_alias.



5
6
7
# File 'lib/log_marker/config.rb', line 5

def ml_alias
  @ml_alias
end

Class Method Details

.config {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (LogMarker)

    the object that the method was called on



7
8
9
# File 'lib/log_marker/config.rb', line 7

def config
  yield self
end

Instance Method Details

#logging_with_marker(&block) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/log_marker.rb', line 18

def logging_with_marker(&block)
  puts marker

  result = block.call

  puts marker.reverse

  result
end

#markerObject



28
29
30
31
32
33
# File 'lib/log_marker.rb', line 28

def marker
  [
    LogMarker.marker.respond_to?(:call) ? LogMarker.marker.call : LogMarker.marker.to_s,
    "\n" * 5
  ]
end

#ml(*args) ⇒ Object



35
36
37
# File 'lib/log_marker.rb', line 35

def ml(*args)
  send(LogMarker.ml_alias, *args)
end