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