class ActiveMerchant::Billing::Rails::Model::Errors

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/active_merchant/billing/compatibility.rb, line 63
def initialize
  super() { |h, k| h[k] = [] }
end

Public Instance Methods

[](key) click to toggle source
Calls superclass method
# File lib/active_merchant/billing/compatibility.rb, line 69
def [](key)
  super(key.to_s)
end
[]=(key, value) click to toggle source
Calls superclass method
# File lib/active_merchant/billing/compatibility.rb, line 73
def []=(key, value)
  super(key.to_s, value)
end
add(field, error) click to toggle source
# File lib/active_merchant/billing/compatibility.rb, line 85
def add(field, error)
  self[field] << error
end
add_to_base(error) click to toggle source
# File lib/active_merchant/billing/compatibility.rb, line 89
def add_to_base(error)
  add(:base, error)
end
each_full(&block) click to toggle source
# File lib/active_merchant/billing/compatibility.rb, line 93
def each_full(&block)
  full_messages.each(&block)
end
empty?() click to toggle source
# File lib/active_merchant/billing/compatibility.rb, line 77
def empty?
  all? { |_k, v| v&.empty? }
end
full_messages() click to toggle source
# File lib/active_merchant/billing/compatibility.rb, line 97
def full_messages
  result = []

  self.each do |key, messages|
    next unless messages && !messages.empty?

    if key == 'base'
      result << messages.first.to_s
    else
      result << "#{Compatibility.humanize(key)} #{messages.first}"
    end
  end

  result
end
on(field) click to toggle source
# File lib/active_merchant/billing/compatibility.rb, line 81
def on(field)
  self[field].to_a.first
end