class SnFoil::Searcher::Boolean
A class that behaves like a boolean type, including rules for coercion of user input.
Coercion¶ ↑
-
“false”, “f” , “0”,
0
or any other value inFALSE_VALUES
will be coerced tofalse
-
Empty strings are coerced to
nil
-
All other values will be coerced to
true
Constants
- FALSE_VALUES
rubocop:disable Lint/BooleanSymbol
Public Instance Methods
cast(value)
click to toggle source
rubocop:enable Lint/BooleanSymbol
# File lib/snfoil/searcher/boolean.rb, line 51 def cast(value) !FALSE_VALUES.include?(value) end