Class: WifiWand::Commands::Password
- Defined in:
- lib/wifi_wand/commands/password.rb
Constant Summary
Constants inherited from Base
Base::DEFAULT_INVOCATION_OPTIONS
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#aliases, allow_invocation_options, allowed_invocation_options, #bind, binding_sources, binds, command_metadata, declared_metadata, #help_text, #initialize, #validate_options
Constructor Details
This class inherits a constructor from WifiWand::Commands::Base
Instance Method Details
#call(*args) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/wifi_wand/commands/password.rb', line 18 def call(*args) validate_max_arguments!(args, 1) network = args.first raise_missing_argument!('<network-name>') if missing_argument?(network) password = model.preferred_network_password(network) human_readable_string_producer = -> do if password <<~MESSAGE.chomp Preferred network "#{network}" stored password is "#{password}". MESSAGE else <<~MESSAGE.chomp Preferred network "#{network}" has no stored password. MESSAGE end end output_support.handle_output(password, human_readable_string_producer) end |