Class: Rack::App::Utils::Parser::Boolean

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/app/utils/parser/boolean.rb

Instance Method Summary collapse

Instance Method Details

#parse(str) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/rack/app/utils/parser/boolean.rb', line 2

def parse(str)
  case true

  when true?(str)
    true

  when false?(str)
    false

  else
    str

  end
end

#validate(str) ⇒ Object



17
18
19
# File 'lib/rack/app/utils/parser/boolean.rb', line 17

def validate(str)
  false?(str) || true?(str)
end