Sha256: 62de7e6cdc84fe13c0152ce74369967a6aa2fc4272797f11589d43980ed4c25a

Contents?: true

Size: 1.74 KB

Versions: 2

Compression:

Stored size: 1.74 KB

Contents

module Discorb
  #
  # Represents a flag.
  # @abstract
  class Flag
    # Initialize the flag.
    # @note This is usually called by the subclass.
    #
    # @param [Integer] value The value of the flag.
    def initialize: (Integer value) -> void

    #
    # Union of two flags.
    #
    # @param [Discorb::Flag] other The other flag.
    #
    # @return [Discorb::Flag] The union of the two flags.
    def |: (instance other) -> instance

    #
    # Subtraction of two flags.
    #
    # @param [Discorb::Flag] other The other flag.
    #
    # @return [Discorb::Flag] The subtraction of the two flags.
    def -: (instance other) -> instance

    #
    # Intersection of two flags.
    #
    # @param [Discorb::Flag] other The other flag.
    #
    # @return [Discorb::Flag] The intersection of the two flags.
    def &: (instance other) -> instance

    #
    # XOR of two flags.
    #
    # @param [Discorb::Flag] other The other flag.
    #
    # @return [Discorb::Flag] The XOR of the two flags.
    def ^: (instance other) -> instance

    #
    # Negation of the flag.
    #
    # @return [Discorb::Flag] The negation of the flag.
    def ~: -> instance

    def to_i: -> Integer

    def inspect: -> String

    #
    # Max value of the flag.
    #
    # @return [Integer] the max value of the flag.
    def self.max_value: -> (Integer | Numeric)

    #
    # Initialize a new flag with keys.
    def self.from_keys: (*Symbol keys) -> untyped

    attr_reader self.bits: Hash[Symbol, Integer]

    # @return [Hash{Symbol => Boolean}] the values of the flag.
    attr_reader values: ::Hash[Symbol, bool]

    # @return [Integer] the value of the flag.
    attr_reader value: Integer
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discorb-0.18.1 sig/discorb/flag.rbs
discorb-0.18.0 sig/discorb/flag.rbs