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.5.0 lib/discorb/extend.rb
discorb-0.4.2 lib/discorb/extend.rb
discorb-0.4.1 lib/discorb/extend.rb
discorb-0.4.0 lib/discorb/extend.rb
discorb-0.3.1 lib/discorb/extend.rb
discorb-0.3.0 lib/discorb/extend.rb
discorb-0.2.5 lib/discorb/extend.rb
discorb-0.2.4 lib/discorb/extend.rb
discorb-0.2.3 lib/discorb/extend.rb
discorb-0.2.1 lib/discorb/extend.rb
discorb-0.2.0 lib/discorb/extend.rb
discorb-0.1.0 lib/discorb/extend.rb
discorb-0.0.8 lib/discorb/extend.rb
discorb-0.0.7 lib/discorb/extend.rb
discorb-0.0.6 lib/discorb/extend.rb
discorb-0.0.5 lib/discorb/extend.rb
discorb-0.0.4 lib/discorb/extend.rb
discorb-0.0.3 lib/discorb/extend.rb
discorb-0.0.2 lib/discorb/extend.rb
discorb-0.0.1 lib/discorb/extend.rb