class Discorb::AuditLog::Entry::Changes

Represents the changes in an audit log entry.

Attributes

data[R]

Public Class Methods

new(data) click to toggle source

@!visibility private

# File lib/discorb/audit_logs.rb, line 222
def initialize(data)
  @data = data.map { |d| [d[:key].to_sym, d] }.to_h
  @data.each do |k, v|
    define_singleton_method(k) { Change.new(v) }
  end
end

Public Instance Methods

[](key) click to toggle source

Get a change with the given key.

@param [Symbol] key The key to get.

@return [Discorb::AuditLog::Entry::Change] The change with the given key. @return [nil] The change with the given key does not exist.

# File lib/discorb/audit_logs.rb, line 250
def [](key)
  @data[key.to_sym]
end
inspect() click to toggle source
# File lib/discorb/audit_logs.rb, line 229
def inspect
  "#<#{self.class} #{@data.length} changes>"
end
keys() click to toggle source

Get keys of changes.

@return [Array<Symbol>] The keys of the changes.

# File lib/discorb/audit_logs.rb, line 238
def keys
  @data.keys
end