Skip to content

Feature: config.truthy helper #6

Description

@grimen

Useful for less verbose environment flag parsing.

Example:

config.truthy(None) # => False
config.truthy(False) # => False
config.truthy(0) # => False
config.truthy("0") # => False
config.truthy("false") # => False
config.truthy("False") # => False
config.truthy("FALSE") # => False
config.truthy("no") # => False # e.g. YAML
config.truthy("No") # => False # e.g. YAML
config.truthy("NO") # => False # e.g. YAML
config.truthy("") # => False
config.truthy("nil") # => False
config.truthy("null") # => False

config.truthy(True) # => True
config.truthy(1) # => True
config.truthy("1") # => True
config.truthy("true") # => True
config.truthy("True") # => True
config.truthy("TRUE") # => True
config.truthy("yes") # => True # e.g. YAML
config.truthy("Yes") # => True # e.g. YAML
config.truthy("YES") # => True # e.g. YAML
config.truthy({}) # => True
config.truthy([]) # => True

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions