class PrintPrimesTable::Validators::ErrorMessage
@author Diego HernĂ¡n Piccinini Lagos An intance contains te error_type and a message to the user
Constants
- MESSAGES
Public Class Methods
new(error_type = :invalid, args = {}, content = nil)
click to toggle source
initialize the message @param content [String] text message to the user @param error_type [Symbol] to qualifies the error @param args [Hash] to include params in the response
# File lib/print_primes_table/validators/error_message.rb, line 16 def initialize(error_type = :invalid, args = {}, content = nil) unless content @content=MESSAGES[error_type] else @content = content end @error_type = error_type @args = args end
Public Instance Methods
show_content()
click to toggle source
@return text message [String] it could contain arguments
# File lib/print_primes_table/validators/error_message.rb, line 26 def show_content "\n" + @content % @args end