Class: Discorb::AuditLog::Entry::Change
- Inherits:
-
DiscordModel
- Object
- DiscordModel
- Discorb::AuditLog::Entry::Change
- Defined in:
- lib/discorb/audit_logs.rb
Overview
Note:
This instance will try to call a method of #new_value if the method wasn't defined.
Represents a change in an audit log entry.
Instance Attribute Summary collapse
-
#key -> Symbol
readonly
The key of the change.
-
#new_value -> Object
readonly
The new value of the change.
-
#old_value -> Object
readonly
The old value of the change.
Instance Method Summary collapse
-
#inspect -> String
Format the change into a string.
-
#method_missing(method) -> Object
Send a message to the new value.
-
#respond_to_missing?(method, include_private = false) -> Boolean
Whether the change responds to the given method.
Methods inherited from DiscordModel
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) -> Object
Send a message to the new value.
356 357 358 |
# File 'lib/discorb/audit_logs.rb', line 356 def method_missing(method, ...) @new_value.__send__(method, ...) end |
Instance Attribute Details
#key -> Symbol (readonly)
Returns The key of the change.
319 320 321 |
# File 'lib/discorb/audit_logs.rb', line 319 def key @key end |
#new_value -> Object (readonly)
Returns The new value of the change.
323 324 325 |
# File 'lib/discorb/audit_logs.rb', line 323 def new_value @new_value end |
#old_value -> Object (readonly)
Returns The old value of the change.
321 322 323 |
# File 'lib/discorb/audit_logs.rb', line 321 def old_value @old_value end |
Instance Method Details
#inspect -> String
Format the change into a string.
365 366 367 |
# File 'lib/discorb/audit_logs.rb', line 365 def inspect "#<#{self.class} #{@key.inspect} #{@old_value.inspect} -> #{@new_value.inspect}>" end |
#respond_to_missing?(method, include_private = false) -> Boolean
Whether the change responds to the given method.
374 375 376 |
# File 'lib/discorb/audit_logs.rb', line 374 def respond_to_missing?(method, include_private = false) @new_value.respond_to?(method, include_private) end |