Class: RubyCord::Guild::AuditLog::Entry::Change

Inherits:
DiscordModel
  • Object
show all
Defined in:
lib/rubycord/guild/audit_log/entry.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

Instance Method Summary collapse

Methods inherited from DiscordModel

#==, #eql?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object

Send a message to the new value.



303
304
305
# File 'lib/rubycord/guild/audit_log/entry.rb', line 303

def method_missing(method, ...)
  @new_value.__send__(method, ...)
end

Instance Attribute Details

#keySymbol (readonly)

Returns The key of the change.

Returns:

  • (Symbol)

    The key of the change.



266
267
268
# File 'lib/rubycord/guild/audit_log/entry.rb', line 266

def key
  @key
end

#new_valueObject (readonly)

Returns The new value of the change.

Returns:

  • (Object)

    The new value of the change.



270
271
272
# File 'lib/rubycord/guild/audit_log/entry.rb', line 270

def new_value
  @new_value
end

#old_valueObject (readonly)

Returns The old value of the change.

Returns:

  • (Object)

    The old value of the change.



268
269
270
# File 'lib/rubycord/guild/audit_log/entry.rb', line 268

def old_value
  @old_value
end

Instance Method Details

#inspectString

Format the change into a string.

Returns:

  • (String)

    The string representation of the change.



312
313
314
# File 'lib/rubycord/guild/audit_log/entry.rb', line 312

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.

Returns:

  • (Boolean)

    Whether the change responds to the given method.



321
322
323
# File 'lib/rubycord/guild/audit_log/entry.rb', line 321

def respond_to_missing?(method, include_private = false)
  @new_value.respond_to?(method, include_private)
end