class NeonRAW::Objects::ModLogUser

The modloguser object. @!attribute [r] note

@return [String, nil] Returns the reason for the banning or nil if there
  is none. This attribute is only available for the banned and
  wikibanned methods.

@!attribute [r] mod_permissions

@return [Array<String>] Returns the mod permissions for the user. This
  attribute is only available for the moderators method.

Public Class Methods

new(client, data) click to toggle source

@!method initialize(client, data) @param client [NeonRAW::Clients::Web/Installed/Script] The client. @param data [Hash] The object data.

# File lib/NeonRAW/objects/modloguser.rb, line 17
def initialize(client, data)
  @client = client
  data.each do |key, value|
    # for consistency, empty strings/arrays/hashes are set to nil
    # because most of the keys returned by Reddit are nil when they
    # don't have a value, besides a few
    value = nil if ['', [], {}].include?(value)
    instance_variable_set(:"@#{key}", value)
    next if key == :date
    self.class.send(:attr_reader, key)
  end
end

Public Instance Methods

date() click to toggle source

Gets the date of when the user was added to the list. @!method date @return [Time] Returns when the user was added to the list.

# File lib/NeonRAW/objects/modloguser.rb, line 33
def date
  Time.at(@date)
end