Class: DiscordRDA::MemberFlags
- Inherits:
-
Object
- Object
- DiscordRDA::MemberFlags
- Defined in:
- lib/discord_rda/entity/support.rb
Overview
Represents member flags
Constant Summary collapse
- FLAGS =
Flag bits
{ did_rejoin: 1 << 0, completed_onboarding: 1 << 1, bypasses_verification: 1 << 2, started_onboarding: 1 << 3, started_home_actions: 1 << 5, completed_home_actions: 1 << 6, automod_quarantined_bio: 1 << 7, automod_quarantined_username_or_nickname: 1 << 8 }.freeze
Instance Attribute Summary collapse
-
#value ⇒ Integer
readonly
Flag value.
Instance Method Summary collapse
-
#has?(flag) ⇒ Boolean
Check if a flag is set.
-
#initialize(value = 0) ⇒ MemberFlags
constructor
Initialize flags.
Constructor Details
#initialize(value = 0) ⇒ MemberFlags
Initialize flags
139 140 141 |
# File 'lib/discord_rda/entity/support.rb', line 139 def initialize(value = 0) @value = value.to_i end |
Instance Attribute Details
#value ⇒ Integer (readonly)
Returns Flag value.
135 136 137 |
# File 'lib/discord_rda/entity/support.rb', line 135 def value @value end |
Instance Method Details
#has?(flag) ⇒ Boolean
Check if a flag is set
146 147 148 149 150 151 |
# File 'lib/discord_rda/entity/support.rb', line 146 def has?(flag) bit = FLAGS[flag.to_sym] return false unless bit (@value & bit) == bit end |