Class: WifiWand::Platforms::Mac::Helper::Setup::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/wifi_wand/platforms/mac/helper/setup.rb

Overview

Immutable value object describing the current state of the helper.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#authorizedObject

Returns the value of attribute authorized

Returns:

  • (Object)

    the current value of authorized



31
32
33
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 31

def authorized
  @authorized
end

#helper_applicableObject

Returns the value of attribute helper_applicable

Returns:

  • (Object)

    the current value of helper_applicable



31
32
33
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 31

def helper_applicable
  @helper_applicable
end

#installedObject

Returns the value of attribute installed

Returns:

  • (Object)

    the current value of installed



31
32
33
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 31

def installed
  @installed
end

#macos_versionObject

Returns the value of attribute macos_version

Returns:

  • (Object)

    the current value of macos_version



31
32
33
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 31

def macos_version
  @macos_version
end

#permission_messageObject

Returns the value of attribute permission_message

Returns:

  • (Object)

    the current value of permission_message



31
32
33
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 31

def permission_message
  @permission_message
end

#validObject

Returns the value of attribute valid

Returns:

  • (Object)

    the current value of valid



31
32
33
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 31

def valid
  @valid
end

Instance Method Details

#authorized?Boolean

Returns:

  • (Boolean)


42
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 42

def authorized? = authorized

#helper_applicable?Boolean

Returns:

  • (Boolean)


43
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 43

def helper_applicable? = helper_applicable != false

#installed?Boolean

Returns:

  • (Boolean)


40
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 40

def installed? = installed

#not_applicable?Boolean

Returns:

  • (Boolean)


44
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 44

def not_applicable? = !helper_applicable?

#reinstall_recommended?Boolean

True when the helper is on disk but failed structural validation (e.g. the bundle is corrupt or the executable does not respond to the help command). In this case reinstall is preferable to a first-time install.

Returns:

  • (Boolean)


53
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 53

def reinstall_recommended? = helper_applicable? && installed? && !valid?

#setup_complete?Boolean

True only when the helper is installed, structurally valid, and macOS location permission has been granted.

Returns:

  • (Boolean)


48
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 48

def setup_complete? = helper_applicable? && installed? && valid? && authorized?

#steps_neededObject

Ordered list of symbolic steps still required. Callers map these to human-readable labels and execution logic.



57
58
59
60
61
62
63
64
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 57

def steps_needed
  return [] unless helper_applicable?
  return %i[reinstall_helper grant_permission] if reinstall_recommended?
  return %i[install_helper grant_permission]   unless installed?
  return %i[grant_permission]                  unless authorized?

  []
end

#valid?Boolean

Returns:

  • (Boolean)


41
# File 'lib/wifi_wand/platforms/mac/helper/setup.rb', line 41

def valid?     = valid