Sha256: 432974753bc8a5f75b5ffe031ca3a7399a73fcafe9e823805874e55298164667

Contents?: true

Size: 517 Bytes

Versions: 3

Compression:

Stored size: 517 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module LunchMoney
  # This class is used to represent errors returned directly from the LunchMoney API
  class Errors
    sig { returns(T::Array[String]) }
    attr_accessor :messages

    sig { params(message: T.nilable(String)).void }
    def initialize(message: nil)
      @messages = T.let([], T::Array[String])

      @messages << message unless message.nil?
    end

    delegate :[], :<<, :each, :to_a, :first, :last, :empty?, :present?, to: :@messages
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lunchmoney-1.1.0 lib/lunchmoney/errors.rb
lunchmoney-1.0.0 lib/lunchmoney/errors.rb
lunchmoney-0.10.0 lib/lunchmoney/errors.rb