Class: Sekisyo::Validators::IntegerValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/sekisyo/validators/integer_validator.rb

Overview

Sekisyo Validators IntegerValidator is a validator that accepts only integer value.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, options = {}) ⇒ IntegerValidator

Returns a new instance of IntegerValidator.



9
10
11
12
# File 'lib/sekisyo/validators/integer_validator.rb', line 9

def initialize(key, options = {})
  @key = key
  @options = options
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



14
15
16
# File 'lib/sekisyo/validators/integer_validator.rb', line 14

def key
  @key
end

Instance Method Details

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
# File 'lib/sekisyo/validators/integer_validator.rb', line 16

def valid?(value)
  type_validate(value) &&
    presence_validate(value) &&
    bytesize_validate(value) &&
    enum_validate(value)
end