Class: Sinatra::Chiro::Parameters::BooleanValidator

Inherits:
Base
  • Object
show all
Defined in:
lib/sinatra/chiro/parameters/boolean.rb

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#default, #description, #initialize, #name, #name_display, #optional, #type, #type_description

Constructor Details

This class inherits a constructor from Sinatra::Chiro::Parameters::Base

Instance Method Details

#commentObject



11
12
13
# File 'lib/sinatra/chiro/parameters/boolean.rb', line 11

def comment
  "Must be true or false"
end

#validate(given) ⇒ Object



5
6
7
8
9
# File 'lib/sinatra/chiro/parameters/boolean.rb', line 5

def validate(given)
  if given[name] != "true" && given[name] != "false"
    "#{name_display} parameter must be true or false"
  end
end