Sha256: c3376f83cb46572a4640e8eedd680f93489d96bf719f4496ad027c2c0af8462b

Contents?: true

Size: 858 Bytes

Versions: 5

Compression:

Stored size: 858 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

5 entries across 5 versions & 1 rubygems

Version Path
discorb-0.19.0 lib/discorb/extend.rb
discorb-0.18.1 lib/discorb/extend.rb
discorb-0.18.0 lib/discorb/extend.rb
discorb-0.17.1 lib/discorb/extend.rb
discorb-0.17.0 lib/discorb/extend.rb