Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: config.truthy helper #6

Open
grimen opened this issue Dec 31, 2018 · 0 comments
Open

Feature: config.truthy helper #6

grimen opened this issue Dec 31, 2018 · 0 comments

Comments

@grimen
Copy link
Owner

grimen commented Dec 31, 2018

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
@grimen grimen added the feature label Dec 31, 2018
@grimen grimen self-assigned this Dec 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant