Class: Y2Network::WirelessAuthMode
- Inherits:
-
Object
- Object
- Y2Network::WirelessAuthMode
- Extended by:
- Yast::I18n
- Includes:
- Yast::I18n
- Defined in:
- src/lib/y2network/wireless_auth_mode.rb
Overview
TODO:
Use this class whenever one of these symbols is used: :none, :open, :shared,
This enum-like class represents the wireless authentication modes
:psk, :eap.
Constant Summary collapse
- NONE =
new(N_("No Encryption"), "none")
- WEP_OPEN =
new(N_("WEP - Open"), "open")
- WEP_SHARED =
new(N_("WEP - Shared Key"), "shared")
- WPA_PSK =
new(N_("WPA-PSK (\"home\")"), "psk")
- WPA_EAP =
new(N_("WPA-EAP (\"enterprise\")"), "eap")
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
Wireless authentication mode name.
-
#short_name ⇒ Object
readonly
Returns the value of attribute short_name.
Class Method Summary collapse
-
.all ⇒ Array<WirelessAuthMode>
Returns all the existing modes.
-
.from_short_name(short_name) ⇒ WirelessAuthMode?
Returns the auth mode with the given short name.
Instance Method Summary collapse
-
#initialize(name, short_name) ⇒ WirelessAuthMode
constructor
Constructor.
-
#to_human_string ⇒ String
Returns the translated name.
-
#to_sym ⇒ Symbol
Returns the symbol representation.
Constructor Details
#initialize(name, short_name) ⇒ WirelessAuthMode
Constructor
60 61 62 63 64 |
# File 'src/lib/y2network/wireless_auth_mode.rb', line 60 def initialize(name, short_name) textdomain "network" @name = name @short_name = short_name end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns Wireless authentication mode name.
54 55 56 |
# File 'src/lib/y2network/wireless_auth_mode.rb', line 54 def name @name end |
#short_name ⇒ Object (readonly)
Returns the value of attribute short_name.
54 |
# File 'src/lib/y2network/wireless_auth_mode.rb', line 54 attr_reader :name, :short_name |
Class Method Details
.all ⇒ Array<WirelessAuthMode>
Returns all the existing modes
35 36 37 38 39 |
# File 'src/lib/y2network/wireless_auth_mode.rb', line 35 def all @all ||= WirelessAuthMode.constants .map { |c| WirelessAuthMode.const_get(c) } .select { |c| c.is_a?(WirelessAuthMode) } end |
.from_short_name(short_name) ⇒ WirelessAuthMode?
Returns the auth mode with the given short name
45 46 47 |
# File 'src/lib/y2network/wireless_auth_mode.rb', line 45 def from_short_name(short_name) all.find { |t| t.short_name == short_name } end |
Instance Method Details
#to_human_string ⇒ String
Returns the translated name
69 70 71 |
# File 'src/lib/y2network/wireless_auth_mode.rb', line 69 def to_human_string _(name) end |
#to_sym ⇒ Symbol
Returns the symbol representation
76 77 78 |
# File 'src/lib/y2network/wireless_auth_mode.rb', line 76 def to_sym short_name.to_sym end |