Class: Resto::Validate::Inclusion

Inherits:
Object
  • Object
show all
Includes:
Resto::Validate
Defined in:
lib/resto/validate/inclusion.rb

Instance Method Summary collapse

Methods included from Resto::Validate

#if, #message, #unless, #validate?

Constructor Details

#initializeInclusion

Returns a new instance of Inclusion.



8
9
10
11
# File 'lib/resto/validate/inclusion.rb', line 8

def initialize
  @allow_nil = false
  @allow_blank = false
end

Instance Method Details

#allow_blankObject



21
22
23
# File 'lib/resto/validate/inclusion.rb', line 21

def allow_blank
  tap { @allow_blank = true }
end

#allow_nilObject



17
18
19
# File 'lib/resto/validate/inclusion.rb', line 17

def allow_nil
  tap { @allow_nil = true }
end

#in(range) ⇒ Object



13
14
15
# File 'lib/resto/validate/inclusion.rb', line 13

def in(range)
  tap { @range = range }
end