Class: Time

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

Overview

rubocop: disable Style/Documentation

Instance Method Summary collapse

Instance Method Details

#to_df(type = nil) -> String

Format a time object to a Discord formatted string.

Parameters:

  • type ("f", "F", "d", "D", "t", "T", "R") (defaults to: nil)

    The format to use.

Returns:

  • (String)

    The formatted time.



13
14
15
16
17
18
19
# File 'lib/discorb/extend.rb', line 13

def to_df(type = nil)
  if type.nil?
    "<t:#{to_i}>"
  else
    "<t:#{to_i}:#{type}>"
  end
end