Sha256: 551449925a79ff4d2817265f0c8428c1df30786b3e07d079b5b2bc4696628160

Contents?: true

Size: 342 Bytes

Versions: 40

Compression:

Stored size: 342 Bytes

Contents

# frozen_string_literal: true

class Time
  #
  # Format a time object to a Discord formatted string.
  #
  # @param ["f", "F", "d", "D", "t", "T", "R"] type The format to use.
  #
  # @return [String] The formatted time.
  #
  def to_df(type = nil)
    if type.nil?
      "<t:#{to_i}>"
    else
      "<t:#{to_i}:#{type}>"
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
discorb-0.9.4 lib/discorb/extend.rb
discorb-0.9.3 lib/discorb/extend.rb
discorb-0.9.1 lib/discorb/extend.rb
discorb-0.9.0 lib/discorb/extend.rb
discorb-0.8.2 lib/discorb/extend.rb
discorb-0.8.1 lib/discorb/extend.rb
discorb-0.8.0 lib/discorb/extend.rb
discorb-0.7.6 lib/discorb/extend.rb
discorb-0.7.3 lib/discorb/extend.rb
discorb-0.7.2 lib/discorb/extend.rb
discorb-0.7.1 lib/discorb/extend.rb
discorb-0.7.0 lib/discorb/extend.rb
discorb-0.6.1 lib/discorb/extend.rb
discorb-0.6.0 lib/discorb/extend.rb
discorb-0.5.6 lib/discorb/extend.rb
discorb-0.5.5 lib/discorb/extend.rb
discorb-0.5.4 lib/discorb/extend.rb
discorb-0.5.3 lib/discorb/extend.rb
discorb-0.5.2 lib/discorb/extend.rb
discorb-0.5.1 lib/discorb/extend.rb