Module: Log::Tags

Included in:
Log
Defined in:
lib/log/tags.rb

Instance Method Summary collapse

Instance Method Details

#excluded_tagsObject Also known as: logger_excluded_tags



12
13
14
# File 'lib/log/tags.rb', line 12

def excluded_tags
  @excluded_tags ||= []
end

#included_tagsObject Also known as: logger_included_tags



7
8
9
# File 'lib/log/tags.rb', line 7

def included_tags
  @included_tags ||= []
end

#tag=(tag) ⇒ Object



36
37
38
# File 'lib/log/tags.rb', line 36

def tag=(tag)
  self.tags = tag
end

#tag?(tag) ⇒ Boolean Also known as: logger_tag?

Returns:

  • (Boolean)


45
46
47
# File 'lib/log/tags.rb', line 45

def tag?(tag)
  tags.include?(tag)
end

#tagsObject Also known as: logger_tags



2
3
4
# File 'lib/log/tags.rb', line 2

def tags
  @tags ||= []
end

#tags=(tags) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/log/tags.rb', line 17

def tags=(tags)
  if tags.nil?
    @tags = nil
    return
  end

  tags = Array(tags)

  tags.each do |tag|
    unless tag.to_s.start_with?('-')
      included_tags << tag
    else
      excluded_tags << tag[1..-1].to_sym
    end
  end

  @tags = tags
end

#tags?Boolean Also known as: logger_tags?

Returns:

  • (Boolean)


40
41
42
# File 'lib/log/tags.rb', line 40

def tags?
  !tags.empty?
end