Class: Discorb::AuditLog::Entry::Change

Inherits:
DiscordModel show all
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

Instance Method Summary collapse

Methods inherited from DiscordModel

#==, #eql?, #hash

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) -> Object



282
283
284
# File 'lib/discorb/audit_logs.rb', line 282

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

Instance Attribute Details

#key -> Symbol (readonly)

Returns The key of the change.

Returns:

  • (Symbol)

    The key of the change.



261
262
263
# File 'lib/discorb/audit_logs.rb', line 261

def key
  @key
end

#new_value -> Object (readonly)

Returns The new value of the change.

Returns:

  • (Object)

    The new value of the change.



265
266
267
# File 'lib/discorb/audit_logs.rb', line 265

def new_value
  @new_value
end

#old_value -> Object (readonly)

Returns The old value of the change.

Returns:

  • (Object)

    The old value of the change.



263
264
265
# File 'lib/discorb/audit_logs.rb', line 263

def old_value
  @old_value
end

Instance Method Details

#inspect -> Object



286
287
288
# File 'lib/discorb/audit_logs.rb', line 286

def inspect
  "#<#{self.class} #{@key.inspect} #{@old_value.inspect} -> #{@new_value.inspect}>"
end

#respond_to_missing?(method, include_private = false) -> Boolean

Returns:

  • (Boolean)


290
291
292
# File 'lib/discorb/audit_logs.rb', line 290

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