Sha256: d5e35ac3c29a96221b6b1b832d044527591f4bebdcb92320508669c2f557d82c

Contents?: true

Size: 857 Bytes

Versions: 4

Compression:

Stored size: 857 Bytes

Contents

# frozen_string_literal: true
# rubocop: disable Style/Documentation

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

# @private
module Async
  class Node
    def description
      @object_name ||= "#{self.class}:0x#{object_id.to_s(16)}#{@transient ? " transient" : nil}"

      if @annotation
        "#{@object_name} #{@annotation}"
      elsif line = self.backtrace(0, 1)&.first
        "#{@object_name} #{line}"
      else
        @object_name
      end
    end

    def to_s
      "\#<#{self.description}>"
    end

    alias inspect to_s
  end
end

# rubocop: enable Style/Documentation

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
discorb-0.16.0 lib/discorb/extend.rb
discorb-0.15.1 lib/discorb/extend.rb
discorb-0.15.0 lib/discorb/extend.rb
discorb-0.14.0 lib/discorb/extend.rb