Module: Card::Set::All::Error::Format

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod004-format/all/error.rb

Instance Method Summary collapse

Instance Method Details

#error_messagesObject



39
40
41
42
43
44
45
46
47
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/error.rb', line 39

def error_messages
  card.errors.map do |error|
    if error.attribute == :abort
      simple_error_message error.message
    else
      standard_error_message error
    end
  end
end

#simple_error_message(message) ⇒ Object

for override



50
51
52
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/error.rb', line 50

def simple_error_message message
  message
end

#standard_error_message(error) ⇒ Object

for override



55
56
57
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/error.rb', line 55

def standard_error_message error
  "#{error.attribute.to_s.upcase}: #{error.message}"
end

#unsupported_view_error_message(view) ⇒ Object



59
60
61
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/error.rb', line 59

def unsupported_view_error_message view
  t :format_unsupported_view, view: view, cardname: card.name
end

#view: bad_addressObject



30
31
32
33
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/error.rb', line 30

view :bad_address, perms: :none do
  root.error_status = 404
  t(:format_bad_address)
end

#view: compact_missingObject



9
10
11
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/error.rb', line 9

view :compact_missing, perms: :none, compact: true do
  ""
end

#view: denialObject



21
22
23
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/error.rb', line 21

view :denial, perms: :none do
  focal? ? t(:format_denial) : ""
end

#view: errorsObject



35
36
37
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/error.rb', line 35

view :errors do
  ["Problem:", "", error_messages].flatten.join "\n"
end

#view: not_foundObject



25
26
27
28
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/error.rb', line 25

view :not_found, perms: :none do
  error_name = card.name.present? ? safe_name : t(:format_not_found_no_name)
  t(:format_not_found_named, cardname: error_name)
end

#view: server_errorObject



17
18
19
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/error.rb', line 17

view :server_error, perms: :none do
  t(:format_server_error)
end

#view: unknownObject



13
14
15
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/error.rb', line 13

view :unknown, perms: :none, cache: :never do
  ""
end