Method: Doing::StringNormalize#normalize_bool

Defined in:
lib/doing/normalize.rb

#normalize_bool(default = :and) ⇒ Object

Convert a boolean string to a symbol

Returns:

  • Symbol :and, :or, or :not



98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/doing/normalize.rb', line 98

def normalize_bool(default = :and)
  case self
  when /(and|all)/i
    :and
  when /(any|or)/i
    :or
  when /(not|none)/i
    :not
  when /^p/i
    :pattern
  else
    default.is_a?(Symbol) ? default : default.normalize_bool
  end
end