Class: Compel::Validation::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/compel/validation/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, klass, error_message = nil) ⇒ Result

Returns a new instance of Result.



10
11
12
13
14
# File 'lib/compel/validation/result.rb', line 10

def initialize(value, klass, error_message = nil)
  @value = value
  @klass = klass
  @error_message = error_message
end

Instance Attribute Details

#error_messageObject (readonly)

Returns the value of attribute error_message.



6
7
8
# File 'lib/compel/validation/result.rb', line 6

def error_message
  @error_message
end

#klassObject (readonly)

Returns the value of attribute klass.



6
7
8
# File 'lib/compel/validation/result.rb', line 6

def klass
  @klass
end

#valueObject (readonly)

Returns the value of attribute value.



6
7
8
# File 'lib/compel/validation/result.rb', line 6

def value
  @value
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/compel/validation/result.rb', line 16

def valid?
  @error_message.nil?
end