Skip to content

Enhance BaseToggle with additional enabled/disabled toggle methods #290

@robrap

Description

@robrap

Enhance BaseToggle with additional methods.

Add the following:

  • is_disabled: Returns not is_enabled.
  • is_toggled_on: Returns is_enabled.
  • is_toggled_off: Returns not is_enabled.

This should make a variety of conditions more readable when ENABLE_ or DISABLE_ are in the toggle name.

Example 1: is_disabled

# BEFORE: slightly less readable
not SOME_FEATURE_TOGGLE.is_enabled()

# AFTER: more clear
SOME_FEATURE_TOGGLE.is_disabled()  

Example 2: is_toggled_off

# BEFORE: brain twister
not DISABLE_SOME_FEATURE.is_enabled()

# AFTER: more clear
DISABLE_SOME_FEATURE.is_toggled_off()  

Notes:

Questions:

  • Is this in fact simpler to understand? Are there better options?
    • We've decided to move forward

Work required:

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueA good task for a newcomer to start withhelp wantedReady to be picked up by anyone in the community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions