1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# frozen_string_literal: true
# A module that can be included for logging functionality.
#
# @example Including the module
# class MyClass
# include Loggable
# end
# Logs a message at info level.
#
# @param message [String] the message to log
# @return [void]
puts
end
# Logs a message at error level.
#
# @param message [String] the message to log
# @param exception [Exception, nil] optional exception
# @return [void]
puts
puts exception.backtrace.first(5).join() if exception
end
end
# A module providing class methods when extended.
# Finds all records matching criteria.
#
# @param criteria [Hash] the search criteria
# @return [Array] matching records
[]
end
end
# A class demonstrating mixin usage.
#
# @see Loggable
# @see ClassMethods
include Loggable
extend ClassMethods
prepend SomeOverrides if defined?(SomeOverrides)
# The identifier.
#
# @return [String]
attr_reader :id
# Creates a new mixed class.
#
# @param id [String] the identifier
@id = id
log_info()
end
end