Sha256: e834b4393fca9390fcc332d079b40d51c1a2d5d9ff98cab35a4d15c8047b2d68
Contents?: true
Size: 636 Bytes
Versions: 12
Compression:
Stored size: 636 Bytes
Contents
# frozen_string_literal: true require "active_model" module Auther module Presenter # Adapter for presenting an account within a view. class Account include ActiveModel::Validations attr_accessor :name, :login, :password validates :name, :login, :password, presence: true def initialize name: "", login: "", password: "" @name = name @login = login @password = password end def error?(key) = errors.key? key def error_message key return "" unless error? key "#{key.capitalize} #{errors.messages[key].first}" end end end end
Version data entries
12 entries across 12 versions & 1 rubygems