Class: Formalist::Form::ValidatedResult

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/formalist/form/validated_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result) ⇒ ValidatedResult

Returns a new instance of ValidatedResult.



18
19
20
# File 'lib/formalist/form/validated_result.rb', line 18

def initialize(result)
  @result = result
end

Instance Attribute Details

#result ⇒ Object (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/formalist/form/validated_result.rb', line 16

def result
  @result
end

Instance Method Details

#messages ⇒ Object



26
27
28
# File 'lib/formalist/form/validated_result.rb', line 26

def messages
  validation.messages
end

#success? ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/formalist/form/validated_result.rb', line 22

def success?
  validation.success?
end

#to_ast ⇒ Object



30
31
32
# File 'lib/formalist/form/validated_result.rb', line 30

def to_ast
  elements.map { |el| el.(output, schema.rules.map(&:to_ary), messages).to_ast }
end