Class: Y2Network::WirelessAuthMode

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, short_name) ⇒ WirelessAuthMode

Constructor

Parameters:

  • name (String)

    Wireless mode name

  • short_name (String)

    Wireles mode short name (e.g., "none")



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

#nameString (readonly)

Returns Wireless authentication mode name.

Returns:

  • (String)

    Wireless authentication mode name



54
55
56
# File 'src/lib/y2network/wireless_auth_mode.rb', line 54

def name
  @name
end

#short_nameObject (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

.allArray<WirelessAuthMode>

Returns all the existing modes

Returns:



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

Parameters:

  • short_name (String)

    Short name

Returns:



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_stringString

Returns the translated name

Returns:

  • (String)


69
70
71
# File 'src/lib/y2network/wireless_auth_mode.rb', line 69

def to_human_string
  _(name)
end

#to_symSymbol

Returns the symbol representation

Returns:

  • (Symbol)


76
77
78
# File 'src/lib/y2network/wireless_auth_mode.rb', line 76

def to_sym
  short_name.to_sym
end