Class: WifiWand::Platforms::Selector
- Inherits:
-
Object
- Object
- WifiWand::Platforms::Selector
- Defined in:
- lib/wifi_wand/platforms/selector.rb
Overview
This class will be helpful in adding support for other OS's. To add an OS, see how each Selection::Base subclass is implemented, implement it, and add it to the list of supported OS's.
For the purpose of this program, an OS is defined as an approach to getting and setting WiFi information. Therefore, although Ubuntu and RedHat are both Linux, they will probably need separate Selection::Base subclasses.
Class Method Summary collapse
- .create_model_for_current_os(options = {}) ⇒ Object
- .current_display_name ⇒ Object
- .current_id ⇒ Object
- .current_os ⇒ Object
- .supported_operating_systems ⇒ Object
Class Method Details
.create_model_for_current_os(options = {}) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/wifi_wand/platforms/selector.rb', line 42 def create_model_for_current_os( = {}) current_os_instance = current_os raise NoSupportedOSError unless current_os_instance current_os_instance.create_model() end |
.current_display_name ⇒ Object
40 |
# File 'lib/wifi_wand/platforms/selector.rb', line 40 def current_display_name = current_os&.display_name |
.current_id ⇒ Object
38 |
# File 'lib/wifi_wand/platforms/selector.rb', line 38 def current_id = current_os&.id |
.current_os ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/wifi_wand/platforms/selector.rb', line 27 def current_os @current_os ||= begin matches = .select(&:current_os_is_this_os?) if matches.size > 1 matching_names = matches.map(&:display_name) raise MultipleOSMatchError, matching_names end matches.first # nil for an unrecognized OS end end |