diff options
author | Lee Jarvis <leejarvis@fastmail.com> | 2022-09-30 15:11:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-30 15:11:25 +0100 |
commit | 24d85e008597128bdc5d173b7e05651f918d0646 (patch) | |
tree | ee0f92886f2d46d1f4f6b0a63c93e068e8814dd2 /lib/slop/types.rb | |
parent | 41af0db78bba76cc7faccbf6adb400e65274f3a3 (diff) | |
parent | 1bcf46b7907d4fc566a1382ad4eda4d0e9354e63 (diff) | |
download | slop-24d85e008597128bdc5d173b7e05651f918d0646.tar.gz |
Merge pull request #276 from eugeneotto/fix-explicitly-false-booleans
Fix explicitly false booleans
Diffstat (limited to 'lib/slop/types.rb')
-rw-r--r-- | lib/slop/types.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/slop/types.rb b/lib/slop/types.rb index 4ccd42e..83e4a0b 100644 --- a/lib/slop/types.rb +++ b/lib/slop/types.rb @@ -21,6 +21,8 @@ module Slop class BoolOption < Option attr_accessor :explicit_value + FALSE_VALUES = [false, 'false', 'no', 'off', '0'].freeze + def call(value) self.explicit_value = value !force_false? @@ -35,7 +37,7 @@ module Slop end def force_false? - explicit_value == false + FALSE_VALUES.include?(explicit_value) end def default_value |