Class: Parxer::Validator::Boolean

Inherits:
Base
  • Object
show all
Defined in:
lib/parxer/validators/boolean_validator.rb

Constant Summary collapse

OPTIONS =
["true", "t", "1", "false", "f", "0"]

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#id, #initialize

Constructor Details

This class inherits a constructor from Parxer::Validator::Base

Instance Method Details

#validateObject



6
7
8
9
10
# File 'lib/parxer/validators/boolean_validator.rb', line 6

def validate
  v = context.value.to_s
  return true if v.blank?
  OPTIONS.include?(v)
end