Class: WifiWand::Commands::Ropen

Inherits:
Base
  • Object
show all
Defined in:
lib/wifi_wand/commands/ropen.rb

Constant Summary

Constants inherited from Base

Base::DEFAULT_INVOCATION_OPTIONS

Instance Attribute Summary

Attributes inherited from Base

#cli, #metadata

Instance Method Summary collapse

Methods inherited from Base

#aliases, allow_invocation_options, allowed_invocation_options, #bind, binding_sources, binds, command_metadata, declared_metadata, #initialize, #validate_options

Constructor Details

This class inherits a constructor from WifiWand::Commands::Base

Instance Method Details

#call(*resource_codes) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/wifi_wand/commands/ropen.rb', line 27

def call(*resource_codes)
  if resource_codes.empty?
    help = resource_manager.available_resources_help

    if interactive_mode
      help
    else
      out_stream.puts(help)
      nil
    end
  else
    invalid_codes = resource_manager.invalid_resource_codes(*resource_codes)

    unless invalid_codes.empty?
      raise WifiWand::ConfigurationError, resource_manager.invalid_codes_error(invalid_codes)
    end

    resource_manager.open_resources_by_codes(model, *resource_codes)
    nil
  end
end

#help_textObject



19
20
21
22
23
24
25
# File 'lib/wifi_wand/commands/ropen.rb', line 19

def help_text
  <<~HELP
    #{super}

    #{resource_manager.available_resources_help}
  HELP
end