Module: Booth::Mode

Defined in:
lib/booth/mode.rb

Class Method Summary collapse

Class Method Details

.allObject



13
14
15
16
17
18
19
20
# File 'lib/booth/mode.rb', line 13

def self.all
  [
    ::Booth::Modes::UsernameAndWebauth, # Recommended for convenience
    ::Booth::Modes::UsernamePasswordAndWebauth, # Most secure
    ::Booth::Modes::UsernamePasswordAndOtp, # If you don't have a hardware key
    ::Booth::Modes::UsernameAndPassword, # Discouraged
  ]
end

.find(symbol) ⇒ Object



3
4
5
6
7
# File 'lib/booth/mode.rb', line 3

def self.find(symbol)
  return if symbol.to_s == 'first_time'

  all.detect { _1.id.to_s == symbol.to_s } || raise("Unknown Booth Mode: #{symbol.inspect}")
end

.wrap(input) ⇒ Object



9
10
11
# File 'lib/booth/mode.rb', line 9

def self.wrap(input)
  Array(input).map { find(_1) }.sort
end