Class: Veri::Inputs::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/veri/inputs/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(value, optional: false, error: Veri::InvalidArgumentError, message: nil) ⇒ Base

Returns a new instance of Base.



4
5
6
7
8
9
# File 'lib/veri/inputs/base.rb', line 4

def initialize(value, optional: false, error: Veri::InvalidArgumentError, message: nil)
  @value = value
  @optional = optional
  @error = error
  @message = message
end

Instance Method Details

#processObject



11
12
13
14
15
# File 'lib/veri/inputs/base.rb', line 11

def process
  return @value if @value.nil? && @optional

  processor.call
end