Class: Stellar::AccountFlags
- Inherits:
-
XDR::Enum
- Object
- XDR::Enum
- Stellar::AccountFlags
- Defined in:
- lib/stellar/account_flags.rb,
generated/stellar/account_flags.rb
Class Method Summary collapse
-
.make_mask(flags = nil) ⇒ Fixnum
Converts an array of Stellar::AccountFlags members into an Integer suitable for use in a SetOptionsOp.
-
.parse_mask(combined) ⇒ Object
Converts an integer used in SetOptionsOp on the set/clear flag options into an array of Stellar::AccountFlags members.
Class Method Details
.make_mask(flags = nil) ⇒ Fixnum
Converts an array of Stellar::AccountFlags members into an Integer suitable for use in a SetOptionsOp.
12 13 14 15 16 |
# File 'lib/stellar/account_flags.rb', line 12 def self.make_mask(flags=nil) flags ||= [] flags.map(&:value).inject(&:|) || 0 end |
.parse_mask(combined) ⇒ Object
Converts an integer used in SetOptionsOp on the set/clear flag options into an array of Stellar::AccountFlags members
@param combined [Fixnum]
@return [Array<Stellar::AccountFlags>]
24 25 26 |
# File 'lib/stellar/account_flags.rb', line 24 def self.parse_mask(combined) members.values.select{|m| (m.value & combined) != 0} end |