Sha256: c64f5eec0a93e7bf95cbdcffca1f0f9ba10bb6a173b4b22df2b1850545a1a5b8
Contents?: true
Size: 605 Bytes
Versions: 12
Compression:
Stored size: 605 Bytes
Contents
# frozen_string_literal: true require "active_model" module Auther # Represents an authenticatable account. Account = Struct.new( :name, :encrypted_login, :encrypted_password, :paths, :authorized_url, :deauthorized_url, keyword_init: true ) do include ActiveModel::Validations validates :name, :encrypted_login, :encrypted_password, presence: true validate :paths_type def initialize *arguments super self[:paths] ||= [] end private def paths_type = (errors.add :paths, "must be an array" unless paths.is_a? Array) end end
Version data entries
12 entries across 12 versions & 1 rubygems