Class: Sinatra::Validation::Result
- Inherits:
-
Object
- Object
- Sinatra::Validation::Result
- Defined in:
- lib/sinatra/validation.rb
Instance Attribute Summary collapse
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(params) ⇒ Result
constructor
A new instance of Result.
- #with_message(errors) ⇒ Object
Constructor Details
#initialize(params) ⇒ Result
Returns a new instance of Result.
17 18 19 |
# File 'lib/sinatra/validation.rb', line 17 def initialize(params) @params = params end |
Instance Attribute Details
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
15 16 17 |
# File 'lib/sinatra/validation.rb', line 15 def @messages end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
15 16 17 |
# File 'lib/sinatra/validation.rb', line 15 def params @params end |
Instance Method Details
#with_message(errors) ⇒ Object
21 22 23 24 |
# File 'lib/sinatra/validation.rb', line 21 def (errors) @messages = errors.to_h.map { |key, | "#{key.to_s} #{.first}" } self end |