Class: Discorb::Embed::Author

Inherits:
Object
  • Object
show all
Defined in:
lib/discorb/embed.rb

Overview

Represents an author of embed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, url: nil, icon: nil) -> Author

Initialize a new Author object.

Parameters:

  • name (String)

    The name of author.

  • url (String) (defaults to: nil)

    The url of author.

  • icon (String) (defaults to: nil)

    The icon url of author.



132
133
134
135
136
# File 'lib/discorb/embed.rb', line 132

def initialize(name, url: nil, icon: nil)
  @name = name
  @url = url
  @icon = icon
end

Instance Attribute Details

#icon -> String?

Returns The icon url of author.

Returns:

  • (String, nil)

    The icon url of author.



123
124
125
# File 'lib/discorb/embed.rb', line 123

def icon
  @icon
end

#name -> String

Returns The name of author.

Returns:

  • (String)

    The name of author.



119
120
121
# File 'lib/discorb/embed.rb', line 119

def name
  @name
end

#url -> String?

Returns The url of author.

Returns:

  • (String, nil)

    The url of author.



121
122
123
# File 'lib/discorb/embed.rb', line 121

def url
  @url
end

Instance Method Details

#to_hash -> Hash

Convert author to hash.

Returns:

  • (Hash)

    Converted author.

See Also:



144
145
146
147
148
149
150
# File 'lib/discorb/embed.rb', line 144

def to_hash
  {
    name: @name,
    url: @url,
    icon_url: @icon,
  }
end