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



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

def excluded_tags
  @excluded_tags ||= []
end

#included_tagsObject Also known as: logger_included_tags



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

def included_tags
  @included_tags ||= []
end

#tag=(tag) ⇒ Object



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

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

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

Returns:

  • (Boolean)


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

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

#tagsObject Also known as: logger_tags



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

def tags
  @tags ||= []
end

#tags=(tags) ⇒ Object



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

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)


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

def tags?
  !tags.empty?
end