Module: Log::SubjectName

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

Instance Method Summary collapse

Instance Method Details

#subject_name(subject) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/log/subject_name.rb', line 3

def subject_name(subject)
  if subject.is_a?(Class) || subject.is_a?(Module)
    name = subject.name
  elsif subject.is_a? String
    name = subject
  elsif subject.is_a? Symbol
    name = subject.to_s
  else
    name = subject.class.name
  end
  name
end